Test cleanups.

This commit is contained in:
Relintai 2023-12-27 18:40:53 +01:00
parent d5294823ef
commit 5776538750
2 changed files with 3 additions and 18 deletions

View File

@ -536,21 +536,21 @@ void MLPPTests::test_mlp(bool ui) {
MLPPMLP model_new(input_set, output_set, 2); MLPPMLP model_new(input_set, output_set, 2);
model_new.gradient_descent(0.1, 10000, ui); model_new.gradient_descent(0.1, 10000, ui);
String res = model_new.model_set_test(input_set)->to_string(); String res = model_new.model_set_test(input_set)->to_string();
res += "\nACCURACY (gradient_descent): " + String::num(100 * model_new.score()) + "%"; res += "\nACCURACY (gradient_descent): " + String::num(100.0 * model_new.score()) + "%";
PLOG_MSG(res); PLOG_MSG(res);
MLPPMLP model_new2(input_set, output_set, 2); MLPPMLP model_new2(input_set, output_set, 2);
model_new2.sgd(0.01, 10000, ui); model_new2.sgd(0.01, 10000, ui);
res = model_new2.model_set_test(input_set)->to_string(); res = model_new2.model_set_test(input_set)->to_string();
res += "\nACCURACY (sgd): " + String::num(100 * model_new2.score()) + "%"; res += "\nACCURACY (sgd): " + String::num(100.0 * model_new2.score()) + "%";
PLOG_MSG(res); PLOG_MSG(res);
MLPPMLP model_new3(input_set, output_set, 2); MLPPMLP model_new3(input_set, output_set, 2);
model_new3.mbgd(0.01, 10000, 2, ui); model_new3.mbgd(0.01, 10000, 2, ui);
res = model_new3.model_set_test(input_set)->to_string(); res = model_new3.model_set_test(input_set)->to_string();
res += "\nACCURACY (mbgd): " + String::num(100 * model_new3.score()) + "%"; res += "\nACCURACY (mbgd): " + String::num(100.0 * model_new3.score()) + "%";
PLOG_MSG(res); PLOG_MSG(res);
} }

View File

@ -119,21 +119,6 @@ void MLPPTestsOld::test_support_vector_classification(bool ui) {
} }
void MLPPTestsOld::test_mlp(bool ui) { void MLPPTestsOld::test_mlp(bool ui) {
MLPPLinAlgOld alg;
// MLP
std::vector<std::vector<real_t>> inputSet = {
{ 0, 0 },
{ 1, 1 },
{ 0, 1 },
{ 1, 0 }
};
std::vector<real_t> outputSet = { 0, 1, 1, 0 };
MLPPMLPOld model(inputSet, outputSet, 2);
model.gradientDescent(0.1, 10000, ui);
alg.printVector(model.modelSetTest(inputSet));
std::cout << "ACCURACY: " << 100 * model.score() << "%" << std::endl;
} }
void MLPPTestsOld::test_soft_max_network(bool ui) { void MLPPTestsOld::test_soft_max_network(bool ui) {
MLPPLinAlgOld alg; MLPPLinAlgOld alg;