From ffa44dfda5ff077e56be8cfdaef137b1d580a1d5 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 24 Jan 2023 19:14:38 +0100 Subject: [PATCH] Fixed remaining errors and added everything to the build. --- SCsub | 40 ++++++++++++++++++++++++++++++++ mlpp/ann/ann.h | 4 ++-- mlpp/convolutions/convolutions.h | 1 + mlpp/cost/cost.cpp | 2 +- mlpp/data/data.cpp | 2 +- mlpp/lin_alg/lin_alg.cpp | 2 +- mlpp/lin_reg/lin_reg.cpp | 11 +++++---- mlpp/regularization/reg.h | 1 + mlpp/stat/stat.cpp | 2 +- mlpp/svc/svc.cpp | 2 +- 10 files changed, 55 insertions(+), 12 deletions(-) diff --git a/SCsub b/SCsub index 14b7f65..4173684 100644 --- a/SCsub +++ b/SCsub @@ -6,6 +6,46 @@ module_env = env.Clone() sources = [ "register_types.cpp", + + "mlpp/activation/activation.cpp", + "mlpp/ann/ann.cpp", + "mlpp/auto_encoder/auto_encoder.cpp", + "mlpp/bernoulli_nb/bernoulli_nb.cpp", + "mlpp/c_log_log_reg/c_log_log_reg.cpp", + "mlpp/convolutions/convolutions.cpp", + "mlpp/cost/cost.cpp", + "mlpp/data/data.cpp", + "mlpp/dual_svc/dual_svc.cpp", + "mlpp/exp_reg/exp_reg.cpp", + "mlpp/gan/gan.cpp", + "mlpp/gaussian_nb/gaussian_nb.cpp", + "mlpp/gauss_markov_checker/gauss_markov_checker.cpp", + "mlpp/hidden_layer/hidden_layer.cpp", + "mlpp/hypothesis_testing/hypothesis_testing.cpp", + "mlpp/kmeans/kmeans.cpp", + "mlpp/knn/knn.cpp", + "mlpp/lin_alg/lin_alg.cpp", + "mlpp/lin_reg/lin_reg.cpp", + "mlpp/log_reg/log_reg.cpp", + "mlpp/mann/mann.cpp", + "mlpp/mlp/mlp.cpp", + "mlpp/multinomial_nb/multinomial_nb.cpp", + "mlpp/multi_output_layer/multi_output_layer.cpp", + "mlpp/numerical_analysis/numerical_analysis.cpp", + "mlpp/outlier_finder/outlier_finder.cpp", + "mlpp/output_layer/output_layer.cpp", + "mlpp/pca/pca.cpp", + "mlpp/probit_reg/probit_reg.cpp", + "mlpp/regularization/reg.cpp", + "mlpp/softmax_net/softmax_net.cpp", + "mlpp/softmax_reg/softmax_reg.cpp", + "mlpp/stat/stat.cpp", + "mlpp/svc/svc.cpp", + "mlpp/tanh_reg/tanh_reg.cpp", + "mlpp/transforms/transforms.cpp", + "mlpp/uni_lin_reg/uni_lin_reg.cpp", + "mlpp/utilities/utilities.cpp", + "mlpp/wgan/wgan.cpp", ] diff --git a/mlpp/ann/ann.h b/mlpp/ann/ann.h index 5ca6b76..aaae521 100644 --- a/mlpp/ann/ann.h +++ b/mlpp/ann/ann.h @@ -7,8 +7,8 @@ // Created by Marc Melikyan on 11/4/20. // -#include "hidden_layer/hidden_layer.h" -#include "output_layer/output_layer.h" +#include "../hidden_layer/hidden_layer.h" +#include "../output_layer/output_layer.h" #include #include diff --git a/mlpp/convolutions/convolutions.h b/mlpp/convolutions/convolutions.h index ce255f1..da9ad31 100644 --- a/mlpp/convolutions/convolutions.h +++ b/mlpp/convolutions/convolutions.h @@ -3,6 +3,7 @@ #define MLPP_CONVOLUTIONS_H #include +#include namespace MLPP { class Convolutions { diff --git a/mlpp/cost/cost.cpp b/mlpp/cost/cost.cpp index f8016b7..06a6192 100644 --- a/mlpp/cost/cost.cpp +++ b/mlpp/cost/cost.cpp @@ -4,7 +4,7 @@ // Created by Marc Melikyan on 1/16/21. // -#include "cost.hpp" +#include "cost.h" #include "../lin_alg/lin_alg.h" #include "../regularization/reg.h" #include diff --git a/mlpp/data/data.cpp b/mlpp/data/data.cpp index b3dd7a8..04a2518 100644 --- a/mlpp/data/data.cpp +++ b/mlpp/data/data.cpp @@ -5,7 +5,7 @@ // Created by Marc Melikyan on 11/4/20. // -#include "data.hpp" +#include "data.h" #include "../lin_alg/lin_alg.h" #include "../softmax_net/softmax_net.h" #include "../stat/stat.h" diff --git a/mlpp/lin_alg/lin_alg.cpp b/mlpp/lin_alg/lin_alg.cpp index 70d1aac..1ee05a7 100644 --- a/mlpp/lin_alg/lin_alg.cpp +++ b/mlpp/lin_alg/lin_alg.cpp @@ -4,7 +4,7 @@ // Created by Marc Melikyan on 1/8/21. // -#include "lin_alg.hpp" +#include "lin_alg.h" #include "../stat/stat.h" #include #include diff --git a/mlpp/lin_reg/lin_reg.cpp b/mlpp/lin_reg/lin_reg.cpp index a4479e9..f3c3859 100644 --- a/mlpp/lin_reg/lin_reg.cpp +++ b/mlpp/lin_reg/lin_reg.cpp @@ -184,12 +184,13 @@ void LinReg::normalEquation() { x_means[i] = (stat.mean(inputSetT[i])); } - try { + //try { std::vector temp; temp.resize(k); temp = alg.mat_vec_mult(alg.inverse(alg.matmult(alg.transpose(inputSet), inputSet)), alg.mat_vec_mult(alg.transpose(inputSet), outputSet)); if (std::isnan(temp[0])) { - throw 99; + //throw 99; + //TODO ERR_FAIL_COND } else { if (reg == "Ridge") { weights = alg.mat_vec_mult(alg.inverse(alg.addition(alg.matmult(alg.transpose(inputSet), inputSet), alg.scalarMultiply(lambda, alg.identity(k)))), alg.mat_vec_mult(alg.transpose(inputSet), outputSet)); @@ -201,9 +202,9 @@ void LinReg::normalEquation() { forwardPass(); } - } catch (int err_num) { - std::cout << "ERR " << err_num << ": Resulting matrix was noninvertible/degenerate, and so the normal equation could not be performed. Try utilizing gradient descent." << std::endl; - } + //} catch (int err_num) { + // std::cout << "ERR " << err_num << ": Resulting matrix was noninvertible/degenerate, and so the normal equation could not be performed. Try utilizing gradient descent." << std::endl; + //} } double LinReg::score() { diff --git a/mlpp/regularization/reg.h b/mlpp/regularization/reg.h index 75ab2da..17eecaf 100644 --- a/mlpp/regularization/reg.h +++ b/mlpp/regularization/reg.h @@ -10,6 +10,7 @@ // #include +#include namespace MLPP { class Reg { diff --git a/mlpp/stat/stat.cpp b/mlpp/stat/stat.cpp index ea79a98..ad2b9c6 100644 --- a/mlpp/stat/stat.cpp +++ b/mlpp/stat/stat.cpp @@ -4,7 +4,7 @@ // Created by Marc Melikyan on 9/29/20. // -#include "stat.hpp" +#include "stat.h" #include "../activation/activation.h" #include "../data/data.h" #include "../lin_alg/lin_alg.h" diff --git a/mlpp/svc/svc.cpp b/mlpp/svc/svc.cpp index 84b317c..bebfd7d 100644 --- a/mlpp/svc/svc.cpp +++ b/mlpp/svc/svc.cpp @@ -4,7 +4,7 @@ // Created by Marc Melikyan on 10/2/20. // -#include "svc.hpp" +#include "svc.h" #include "../activation/activation.h" #include "../cost/cost.h" #include "../lin_alg/lin_alg.h"