src/mlpack/tests/logistic_regression_test.cpp
BOOST_AUTO_TEST_CASE(LogisticRegressionFunctionEvaluate)
{
  // Very simple fake dataset.
  arma::mat data("1 2 3;"
                 "1 2 3");
  arma::Row<size_t> responses("1 1 0");

  // Create a LogisticRegressionFunction.
  LogisticRegressionFunction<> lrf(data, responses,
      0.0 /* no regularization */);

  // These were hand-calculated using Octave.
  BOOST_REQUIRE_CLOSE(lrf.Evaluate(arma::rowvec("1 1 1")), 7.0562141665, 1e-5);
  BOOST_REQUIRE_CLOSE(lrf.Evaluate(arma::rowvec("0 0 0")), 2.0794415417, 1e-5);
  BOOST_REQUIRE_CLOSE(lrf.Evaluate(arma::rowvec("-1 -1 -1")), 8.0562141665,
      1e-5);
  BOOST_REQUIRE_CLOSE(lrf.Evaluate(arma::rowvec("200 -40 -40")), 0.0, 1e-5);
  BOOST_REQUIRE_CLOSE(lrf.Evaluate(arma::rowvec("200 -80 0")), 0.0, 1e-5);
  BOOST_REQUIRE_CLOSE(lrf.Evaluate(arma::rowvec("200 -100 20")), 0.0, 1e-5);
}
/**
 * Test the LogisticRegressionFunction on a simple set of points.
 */
Test the LogisticRegressionFunction on a simple set of points.
Test the LogisticRegressionFunction on a simple set of points .
BOOST_AUTO_TEST_CASE(LogisticRegressionFunctionEvaluate)
{
  arma::mat data("1 2 3;"
                 "1 2 3");
  arma::Row<size_t> responses("1 1 0");
  LogisticRegressionFunction<> lrf(data, responses,
      0.0 );
  BOOST_REQUIRE_CLOSE(lrf.Evaluate(arma::rowvec("1 1 1")), 7.0562141665, 1e-5);
  BOOST_REQUIRE_CLOSE(lrf.Evaluate(arma::rowvec("0 0 0")), 2.0794415417, 1e-5);
  BOOST_REQUIRE_CLOSE(lrf.Evaluate(arma::rowvec("-1 -1 -1")), 8.0562141665,
      1e-5);
  BOOST_REQUIRE_CLOSE(lrf.Evaluate(arma::rowvec("200 -40 -40")), 0.0, 1e-5);
  BOOST_REQUIRE_CLOSE(lrf.Evaluate(arma::rowvec("200 -80 0")), 0.0, 1e-5);
  BOOST_REQUIRE_CLOSE(lrf.Evaluate(arma::rowvec("200 -100 20")), 0.0, 1e-5);
}
BOOST_AUTO_TEST_CASE ( LogisticRegressionFunctionEvaluate ) { arma :: mat data ( " " " " ) ; arma :: Row < size_t > responses ( " " ) ; LogisticRegressionFunction < > lrf ( data , responses , 0.0 ) ; BOOST_REQUIRE_CLOSE ( lrf . Evaluate ( arma :: rowvec ( " " ) ) , 7.0562141665 , 1e-5 ) ; BOOST_REQUIRE_CLOSE ( lrf . Evaluate ( arma :: rowvec ( " " ) ) , 2.0794415417 , 1e-5 ) ; BOOST_REQUIRE_CLOSE ( lrf . Evaluate ( arma :: rowvec ( " " ) ) , 8.0562141665 , 1e-5 ) ; BOOST_REQUIRE_CLOSE ( lrf . Evaluate ( arma :: rowvec ( " " ) ) , 0.0 , 1e-5 ) ; BOOST_REQUIRE_CLOSE ( lrf . Evaluate ( arma :: rowvec ( " " ) ) , 0.0 , 1e-5 ) ; BOOST_REQUIRE_CLOSE ( lrf . Evaluate ( arma :: rowvec ( " " ) ) , 0.0 , 1e-5 ) ; }
Test the LogisticRegressionFunction on a simple set of points.
Test the LogisticRegressionFunction on a simple set of points .
// Very simple fake dataset. // Create a LogisticRegressionFunction. /* no regularization */ // These were hand-calculated using Octave.