src/mlpack/tests/lars_test.cpp
BOOST_AUTO_TEST_CASE(RetrainCholeskyTest)
{
  arma::mat origX;
  arma::rowvec origY;
  GenerateProblem(origX, origY, 1000, 50);

  arma::mat newX;
  arma::rowvec newY;
  GenerateProblem(newX, newY, 750, 75);

  LARS lars(true, 0.1, 0.1);
  arma::vec betaOpt;
  lars.Train(origX, origY, betaOpt);

  // Now train on new data.
  lars.Train(newX, newY, betaOpt);

  arma::vec errCorr = (newX * trans(newX) + 0.1 *
        arma::eye(75, 75)) * betaOpt - newX * newY.t();

  LARSVerifyCorrectness(betaOpt, errCorr, 0.1);
}
/**
 * Make sure if we train twice using the Cholesky decomposition, there is no
 * issue.
 */
Make sure if we train twice using the Cholesky decomposition, there is no
issue.
Make sure if we train twice using the Cholesky decomposition there is no issue .
BOOST_AUTO_TEST_CASE(RetrainCholeskyTest)
{
  arma::mat origX;
  arma::rowvec origY;
  GenerateProblem(origX, origY, 1000, 50);
  arma::mat newX;
  arma::rowvec newY;
  GenerateProblem(newX, newY, 750, 75);
  LARS lars(true, 0.1, 0.1);
  arma::vec betaOpt;
  lars.Train(origX, origY, betaOpt);
  lars.Train(newX, newY, betaOpt);
  arma::vec errCorr = (newX * trans(newX) + 0.1 *
        arma::eye(75, 75)) * betaOpt - newX * newY.t();
  LARSVerifyCorrectness(betaOpt, errCorr, 0.1);
}
BOOST_AUTO_TEST_CASE ( RetrainCholeskyTest ) { arma :: mat origX ; arma :: rowvec origY ; GenerateProblem ( origX , origY , 1000 , 50 ) ; arma :: mat newX ; arma :: rowvec newY ; GenerateProblem ( newX , newY , 750 , 75 ) ; LARS lars ( true , 0.1 , 0.1 ) ; arma :: vec betaOpt ; lars . Train ( origX , origY , betaOpt ) ; lars . Train ( newX , newY , betaOpt ) ; arma :: vec errCorr = ( newX * trans ( newX ) + 0.1 * arma :: eye ( 75 , 75 ) ) * betaOpt - newX * newY . t ( ) ; LARSVerifyCorrectness ( betaOpt , errCorr , 0.1 ) ; }
Make sure if we train twice using the Cholesky decomposition, there is no
 issue.
Make sure if we train twice using the Cholesky decomposition there is no issue .
// Now train on new data.