Reviewed Changes
This commit is contained in:
@@ -112,20 +112,11 @@ BOOST_AUTO_TEST_CASE(DecisionStumpLabelsLessDimensionTest)
|
||||
|
||||
size_t testSize = testData.n_cols;
|
||||
|
||||
// Delete the last row containing labels from input dataset
|
||||
// and store it as a new dataset to be used while training
|
||||
// second model.
|
||||
arma::mat inputData2 = inputData;
|
||||
inputData2.shed_row(inputData2.n_rows - 1);
|
||||
|
||||
// Create a copy of testData to be reused.
|
||||
arma::mat testData2 = testData;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("training", inputData);
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -147,9 +138,12 @@ BOOST_AUTO_TEST_CASE(DecisionStumpLabelsLessDimensionTest)
|
||||
|
||||
// Now train DS with labels provided.
|
||||
|
||||
// Delete last row of inputData.
|
||||
inputData.shed_row(inputData.n_rows - 1);
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData2));
|
||||
SetInputParam("test", std::move(testData2));
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("test", std::move(testData));
|
||||
// Pass Labels.
|
||||
SetInputParam("labels", std::move(labels));
|
||||
|
||||
@@ -186,14 +180,11 @@ BOOST_AUTO_TEST_CASE(DecisionStumpModelReuseTest)
|
||||
|
||||
size_t testSize = testData.n_cols;
|
||||
|
||||
// Create a copy of testData to be reused.
|
||||
arma::mat testData2 = testData;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -205,7 +196,7 @@ BOOST_AUTO_TEST_CASE(DecisionStumpModelReuseTest)
|
||||
CLI::GetSingleton().Parameters()["test"].wasPassed = false;
|
||||
|
||||
// Input trained model.
|
||||
SetInputParam("test", std::move(testData2));
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("input_model",
|
||||
std::move(CLI::GetParam<DSModel>("output_model")));
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(DecisionModelReuseTest)
|
||||
SetInputParam("weights", std::move(weights));
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -154,9 +154,6 @@ BOOST_AUTO_TEST_CASE(DecisionModelReuseTest)
|
||||
CLI::GetSingleton().Parameters()["weights"].wasPassed = false;
|
||||
CLI::GetSingleton().Parameters()["test"].wasPassed = false;
|
||||
|
||||
if (!data::Load("vc2_test.csv", testData))
|
||||
BOOST_FAIL("Cannot load test dataset vc2.csv!");
|
||||
|
||||
// Input trained model.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("input_model",
|
||||
|
||||
@@ -114,20 +114,11 @@ BOOST_AUTO_TEST_CASE(NBCLabelsLessDimensionTest)
|
||||
|
||||
size_t testSize = testData.n_cols;
|
||||
|
||||
// Delete the last row containing labels from input dataset
|
||||
// and store it as a new dataset to be used while training
|
||||
// second model.
|
||||
arma::mat inputData2 = inputData;
|
||||
inputData2.shed_row(inputData2.n_rows - 1);
|
||||
|
||||
// Create a copy of testData to be reused.
|
||||
arma::mat testData2 = testData;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("training", inputData);
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -153,9 +144,11 @@ BOOST_AUTO_TEST_CASE(NBCLabelsLessDimensionTest)
|
||||
|
||||
// Now train NBC with labels provided.
|
||||
|
||||
inputData.shed_row(inputData.n_rows - 1);
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData2));
|
||||
SetInputParam("test", std::move(testData2));
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("test", std::move(testData));
|
||||
// Pass Labels.
|
||||
SetInputParam("labels", std::move(labels));
|
||||
|
||||
@@ -195,14 +188,11 @@ BOOST_AUTO_TEST_CASE(NBCModelReuseTest)
|
||||
|
||||
size_t testSize = testData.n_cols;
|
||||
|
||||
// Create a copy of testData to be reused.
|
||||
arma::mat testData2 = testData;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -216,7 +206,7 @@ BOOST_AUTO_TEST_CASE(NBCModelReuseTest)
|
||||
CLI::GetSingleton().Parameters()["test"].wasPassed = false;
|
||||
|
||||
// Input trained model.
|
||||
SetInputParam("test", std::move(testData2));
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("input_model",
|
||||
std::move(CLI::GetParam<NBCModel>("output_model")));
|
||||
|
||||
@@ -281,17 +271,11 @@ BOOST_AUTO_TEST_CASE(NBCIncrementalVarianceTest)
|
||||
|
||||
size_t testSize = testData.n_cols;
|
||||
|
||||
// Create a copy of inputData to be reused.
|
||||
arma::mat inputData2 = inputData;
|
||||
|
||||
// Create a copy of testData to be reused.
|
||||
arma::mat testData2 = testData;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("training", inputData);
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
SetInputParam("incremental_variance", (bool) true);
|
||||
|
||||
mlpackMain();
|
||||
@@ -320,8 +304,8 @@ BOOST_AUTO_TEST_CASE(NBCIncrementalVarianceTest)
|
||||
// Now train NBC without incremental_variance.
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData2));
|
||||
SetInputParam("test", std::move(testData2));
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("incremental_variance", (bool) false);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -112,20 +112,11 @@ BOOST_AUTO_TEST_CASE(PerceptronLabelsLessDimensionTest)
|
||||
|
||||
size_t testSize = testData.n_cols;
|
||||
|
||||
// Delete the last row containing labels from input dataset
|
||||
// and store it as a new dataset to be used while training
|
||||
// second model.
|
||||
arma::mat inputData2 = inputData;
|
||||
inputData2.shed_row(inputData2.n_rows - 1);
|
||||
|
||||
// Create a copy of testData to be reused.
|
||||
arma::mat testData2 = testData;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("training", inputData);
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -140,6 +131,8 @@ BOOST_AUTO_TEST_CASE(PerceptronLabelsLessDimensionTest)
|
||||
CLI::GetSingleton().Parameters()["training"].wasPassed = false;
|
||||
CLI::GetSingleton().Parameters()["test"].wasPassed = false;
|
||||
|
||||
inputData.shed_row(inputData.n_rows - 1);
|
||||
|
||||
// Store outputs.
|
||||
arma::Row<size_t> output;
|
||||
output = std::move(CLI::GetParam<arma::Row<size_t>>("output"));
|
||||
@@ -147,8 +140,8 @@ BOOST_AUTO_TEST_CASE(PerceptronLabelsLessDimensionTest)
|
||||
// Now train pereptron with labels provided.
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData2));
|
||||
SetInputParam("test", std::move(testData2));
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("test", std::move(testData));
|
||||
// Pass Labels.
|
||||
SetInputParam("labels", std::move(labels));
|
||||
|
||||
@@ -184,14 +177,11 @@ BOOST_AUTO_TEST_CASE(PerceptronModelReuseTest)
|
||||
|
||||
size_t testSize = testData.n_cols;
|
||||
|
||||
// Create a copy of testData to be reused.
|
||||
arma::mat testData2 = testData;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -203,7 +193,7 @@ BOOST_AUTO_TEST_CASE(PerceptronModelReuseTest)
|
||||
CLI::GetSingleton().Parameters()["test"].wasPassed = false;
|
||||
|
||||
// Input trained model.
|
||||
SetInputParam("test", std::move(testData2));
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("input_model",
|
||||
std::move(CLI::GetParam<PerceptronModel>("output_model")));
|
||||
|
||||
|
||||
@@ -102,15 +102,12 @@ BOOST_AUTO_TEST_CASE(RandomForestModelReuseTest)
|
||||
|
||||
size_t testSize = testData.n_cols;
|
||||
|
||||
// Create a copy of testData to be reused.
|
||||
arma::mat testData2 = testData;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("labels", std::move(labels));
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -125,7 +122,7 @@ BOOST_AUTO_TEST_CASE(RandomForestModelReuseTest)
|
||||
CLI::GetSingleton().Parameters()["test"].wasPassed = false;
|
||||
|
||||
// Input trained model.
|
||||
SetInputParam("test", std::move(testData2));
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("input_model",
|
||||
std::move(CLI::GetParam<RandomForestModel>("output_model")));
|
||||
|
||||
@@ -230,34 +227,26 @@ BOOST_AUTO_TEST_CASE(RandomForestDiffMinLeafSizeTest)
|
||||
if (!data::Load("vc2_labels.txt", labels))
|
||||
BOOST_FAIL("Cannot load labels for vc2_labels.txt");
|
||||
|
||||
// Create copy of training data.
|
||||
arma::mat inputData2 = inputData;
|
||||
arma::Row<size_t> labels2 = labels;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("labels", std::move(labels));
|
||||
SetInputParam("training", inputData);
|
||||
SetInputParam("labels", labels);
|
||||
SetInputParam("minimum_leaf_size", (int) 20);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
// Calculate training accuracy.
|
||||
arma::Row<size_t> predictions;
|
||||
CLI::GetParam<RandomForestModel>("output_model").rf.Classify(inputData2,
|
||||
CLI::GetParam<RandomForestModel>("output_model").rf.Classify(inputData,
|
||||
predictions);
|
||||
|
||||
size_t correct = arma::accu(predictions == labels2);
|
||||
double accuracy20 = (double(correct) / double(labels2.n_elem) * 100);
|
||||
|
||||
// Create copy of training data.
|
||||
inputData = inputData2;
|
||||
labels = labels2;
|
||||
size_t correct = arma::accu(predictions == labels);
|
||||
double accuracy20 = (double(correct) / double(labels.n_elem) * 100);
|
||||
|
||||
// Train for minimium leaf size 10.
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData2));
|
||||
SetInputParam("labels", std::move(labels2));
|
||||
SetInputParam("training", inputData);
|
||||
SetInputParam("labels", labels);
|
||||
SetInputParam("minimum_leaf_size", (int) 10);
|
||||
|
||||
mlpackMain();
|
||||
@@ -269,25 +258,21 @@ BOOST_AUTO_TEST_CASE(RandomForestDiffMinLeafSizeTest)
|
||||
correct = arma::accu(predictions == labels);
|
||||
double accuracy10 = (double(correct) / double(labels.n_elem) * 100);
|
||||
|
||||
// Create copy of training data.
|
||||
inputData2 = inputData;
|
||||
labels2 = labels;
|
||||
|
||||
// Train for minimium leaf size 1.
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("labels", std::move(labels));
|
||||
SetInputParam("training", inputData);
|
||||
SetInputParam("labels", labels);
|
||||
SetInputParam("minimum_leaf_size", (int) 1);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
// Calculate training accuracy.
|
||||
CLI::GetParam<RandomForestModel>("output_model").rf.Classify(inputData2,
|
||||
CLI::GetParam<RandomForestModel>("output_model").rf.Classify(inputData,
|
||||
predictions);
|
||||
|
||||
correct = arma::accu(predictions == labels2);
|
||||
double accuracy1 = (double(correct) / double(labels2.n_elem) * 100);
|
||||
correct = arma::accu(predictions == labels);
|
||||
double accuracy1 = (double(correct) / double(labels.n_elem) * 100);
|
||||
|
||||
BOOST_REQUIRE(accuracy1 > accuracy10 && accuracy10 > accuracy20);
|
||||
}
|
||||
@@ -314,12 +299,9 @@ BOOST_AUTO_TEST_CASE(RandomForestDiffNumTreeTest)
|
||||
if (!data::Load("vc2_test_labels.txt", testLabels))
|
||||
BOOST_FAIL("Cannot load labels for vc2__test_labels.txt");
|
||||
|
||||
// Create copy of training data.
|
||||
arma::mat inputData2 = inputData;
|
||||
arma::Row<size_t> labels2 = labels;
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("labels", std::move(labels));
|
||||
SetInputParam("training", inputData);
|
||||
SetInputParam("labels", labels);
|
||||
SetInputParam("num_trees", (int) 1);
|
||||
|
||||
mlpackMain();
|
||||
@@ -332,15 +314,11 @@ BOOST_AUTO_TEST_CASE(RandomForestDiffNumTreeTest)
|
||||
size_t correct = arma::accu(predictions == testLabels);
|
||||
double accuracy1 = (double(correct) / double(testLabels.n_elem) * 100);
|
||||
|
||||
// Create copy of training data.
|
||||
inputData = inputData2;
|
||||
labels = labels2;
|
||||
|
||||
// Train for num_trees 5.
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData2));
|
||||
SetInputParam("labels", std::move(labels2));
|
||||
SetInputParam("training", inputData);
|
||||
SetInputParam("labels", labels);
|
||||
SetInputParam("num_trees", (int) 5);
|
||||
|
||||
mlpackMain();
|
||||
@@ -352,10 +330,6 @@ BOOST_AUTO_TEST_CASE(RandomForestDiffNumTreeTest)
|
||||
correct = arma::accu(predictions == testLabels);
|
||||
double accuracy5 = (double(correct) / double(testLabels.n_elem) * 100);
|
||||
|
||||
// Create copy of training data.
|
||||
inputData2 = inputData;
|
||||
labels2 = labels;
|
||||
|
||||
// Train for num_trees 10.
|
||||
|
||||
// Input training data.
|
||||
|
||||
@@ -130,15 +130,12 @@ BOOST_AUTO_TEST_CASE(SoftmaxRegressionModelReuseTest)
|
||||
|
||||
size_t testSize = testData.n_cols;
|
||||
|
||||
// Create a copy of testData to be reused.
|
||||
arma::mat testData2 = testData;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("labels", std::move(labels));
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -151,7 +148,7 @@ BOOST_AUTO_TEST_CASE(SoftmaxRegressionModelReuseTest)
|
||||
CLI::GetSingleton().Parameters()["test"].wasPassed = false;
|
||||
|
||||
// Input trained model.
|
||||
SetInputParam("test", std::move(testData2));
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("input_model",
|
||||
std::move(CLI::GetParam<SoftmaxRegression>("output_model")));
|
||||
|
||||
@@ -311,18 +308,13 @@ BOOST_AUTO_TEST_CASE(SoftmaxRegressionDiffLambdaTest)
|
||||
|
||||
size_t testSize = testData.n_cols;
|
||||
|
||||
// Create a copy of data to be reused.
|
||||
arma::mat inputData2 = inputData;
|
||||
arma::mat testData2 = testData;
|
||||
arma::Row<size_t> labels2 = labels;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("labels", std::move(labels));
|
||||
SetInputParam("training", inputData);
|
||||
SetInputParam("labels", labels);
|
||||
SetInputParam("lambda", (double) 0.1);
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -333,33 +325,25 @@ BOOST_AUTO_TEST_CASE(SoftmaxRegressionDiffLambdaTest)
|
||||
// Reset passed parameters.
|
||||
CLI::GetSingleton().Parameters()["training"].wasPassed = false;
|
||||
CLI::GetSingleton().Parameters()["labels"].wasPassed = false;
|
||||
CLI::GetSingleton().Parameters()["lambda"].wasPassed = false;
|
||||
CLI::GetSingleton().Parameters()["test"].wasPassed = false;
|
||||
|
||||
// Train SR for lamda 0.9.
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData2));
|
||||
SetInputParam("labels", std::move(labels2));
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("labels", std::move(labels));
|
||||
SetInputParam("lambda", (double) 0.9);
|
||||
SetInputParam("test", std::move(testData2));
|
||||
SetInputParam("test", std::move(testData));
|
||||
|
||||
mlpackMain();
|
||||
|
||||
// Check that initial parameters and final parameters matrix
|
||||
// using saved model are different.
|
||||
bool flag = false;
|
||||
bool* flagPtr = &flag;
|
||||
for (size_t i = 0; i < modelParam.n_elem; ++i)
|
||||
{
|
||||
if ((int) (modelParam[i] * 1e+6) != (int) (CLI::GetParam<SoftmaxRegression>
|
||||
("output_model").Parameters()[i] * 1e+6))
|
||||
{
|
||||
*flagPtr = true;
|
||||
break;
|
||||
}
|
||||
BOOST_REQUIRE_NE(modelParam[i],
|
||||
CLI::GetParam<SoftmaxRegression>("output_model").Parameters()[i]);
|
||||
}
|
||||
BOOST_REQUIRE_EQUAL(flag, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -390,18 +374,13 @@ BOOST_AUTO_TEST_CASE(SoftmaxRegressionDiffMaxItrTest)
|
||||
|
||||
size_t testSize = testData.n_cols;
|
||||
|
||||
// Create a copy of data to be reused.
|
||||
arma::mat inputData2 = inputData;
|
||||
arma::mat testData2 = testData;
|
||||
arma::Row<size_t> labels2 = labels;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("labels", std::move(labels));
|
||||
SetInputParam("training", inputData);
|
||||
SetInputParam("labels", labels);
|
||||
SetInputParam("max_iterations", (int) 500);
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -412,33 +391,25 @@ BOOST_AUTO_TEST_CASE(SoftmaxRegressionDiffMaxItrTest)
|
||||
// Reset passed parameters.
|
||||
CLI::GetSingleton().Parameters()["training"].wasPassed = false;
|
||||
CLI::GetSingleton().Parameters()["labels"].wasPassed = false;
|
||||
CLI::GetSingleton().Parameters()["max_iterations"].wasPassed = false;
|
||||
CLI::GetSingleton().Parameters()["test"].wasPassed = false;
|
||||
|
||||
// Train SR for lamda 0.9.
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData2));
|
||||
SetInputParam("labels", std::move(labels2));
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("labels", std::move(labels));
|
||||
SetInputParam("max_iterations", (int) 1000);
|
||||
SetInputParam("test", std::move(testData2));
|
||||
SetInputParam("test", std::move(testData));
|
||||
|
||||
mlpackMain();
|
||||
|
||||
// Check that initial parameters and final parameters matrix
|
||||
// using saved model are different.
|
||||
bool flag = false;
|
||||
bool* flagPtr = &flag;
|
||||
for (size_t i = 0; i < modelParam.n_elem; ++i)
|
||||
{
|
||||
if ((int) (modelParam[i] * 1e+6) != (int) (CLI::GetParam<SoftmaxRegression>
|
||||
("output_model").Parameters()[i] * 1e+6))
|
||||
{
|
||||
*flagPtr = true;
|
||||
break;
|
||||
}
|
||||
BOOST_REQUIRE_NE(modelParam[i],
|
||||
CLI::GetParam<SoftmaxRegression>("output_model").Parameters()[i]);
|
||||
}
|
||||
BOOST_REQUIRE_EQUAL(flag, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -469,18 +440,13 @@ BOOST_AUTO_TEST_CASE(SoftmaxRegressionDiffInterceptTest)
|
||||
|
||||
size_t testSize = testData.n_cols;
|
||||
|
||||
// Create a copy of data to be reused.
|
||||
arma::mat inputData2 = inputData;
|
||||
arma::mat testData2 = testData;
|
||||
arma::Row<size_t> labels2 = labels;
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("labels", std::move(labels));
|
||||
SetInputParam("training", inputData);
|
||||
SetInputParam("labels", labels);
|
||||
SetInputParam("no_intercept", (bool) true);
|
||||
|
||||
// Input test data.
|
||||
SetInputParam("test", std::move(testData));
|
||||
SetInputParam("test", testData);
|
||||
|
||||
mlpackMain();
|
||||
|
||||
@@ -497,17 +463,17 @@ BOOST_AUTO_TEST_CASE(SoftmaxRegressionDiffInterceptTest)
|
||||
// Train SR for no_intercept.
|
||||
|
||||
// Input training data.
|
||||
SetInputParam("training", std::move(inputData2));
|
||||
SetInputParam("labels", std::move(labels2));
|
||||
SetInputParam("test", std::move(testData2));
|
||||
SetInputParam("training", std::move(inputData));
|
||||
SetInputParam("labels", std::move(labels));
|
||||
SetInputParam("test", std::move(testData));
|
||||
|
||||
mlpackMain();
|
||||
|
||||
// Check that initial parameters has 1 more parameter than
|
||||
// final parameters matrix.
|
||||
BOOST_REQUIRE_EQUAL(
|
||||
CLI::GetParam<SoftmaxRegression>("output_model").Parameters().n_cols,
|
||||
modelParam.n_cols + 1);
|
||||
CLI::GetParam<SoftmaxRegression>("output_model").Parameters().n_cols,
|
||||
modelParam.n_cols + 1);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END();
|
||||
|
||||
Reference in New Issue
Block a user