Fixed remaining errors and added everything to the build.

This commit is contained in:
Relintai 2023-01-24 19:14:38 +01:00
parent 4675ee8e58
commit ffa44dfda5
10 changed files with 55 additions and 12 deletions

40
SCsub
View File

@ -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",
]

View File

@ -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 <string>
#include <tuple>

View File

@ -3,6 +3,7 @@
#define MLPP_CONVOLUTIONS_H
#include <vector>
#include <string>
namespace MLPP {
class Convolutions {

View File

@ -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 <cmath>

View File

@ -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"

View File

@ -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 <cmath>
#include <iostream>

View File

@ -184,12 +184,13 @@ void LinReg::normalEquation() {
x_means[i] = (stat.mean(inputSetT[i]));
}
try {
//try {
std::vector<double> 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() {

View File

@ -10,6 +10,7 @@
//
#include <vector>
#include <string>
namespace MLPP {
class Reg {

View File

@ -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"

View File

@ -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"