2023-01-24 18:57:18 +01:00
|
|
|
|
|
|
|
#ifndef MLPP_MULTI_OUTPUT_LAYER_H
|
|
|
|
#define MLPP_MULTI_OUTPUT_LAYER_H
|
|
|
|
|
2023-01-23 21:13:26 +01:00
|
|
|
//
|
|
|
|
// MultiOutputLayer.hpp
|
|
|
|
//
|
|
|
|
// Created by Marc Melikyan on 11/4/20.
|
|
|
|
//
|
|
|
|
|
2023-01-24 18:12:23 +01:00
|
|
|
#include "../activation/activation.h"
|
|
|
|
#include "../cost/cost.h"
|
2023-01-23 21:13:26 +01:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2023-01-24 19:00:54 +01:00
|
|
|
#include <vector>
|
2023-01-23 21:13:26 +01:00
|
|
|
|
2023-01-24 19:20:18 +01:00
|
|
|
|
2023-01-24 19:00:54 +01:00
|
|
|
class MultiOutputLayer {
|
|
|
|
public:
|
|
|
|
MultiOutputLayer(int n_output, int n_hidden, std::string activation, std::string cost, std::vector<std::vector<double>> input, std::string weightInit, std::string reg, double lambda, double alpha);
|
2023-01-23 21:13:26 +01:00
|
|
|
|
2023-01-24 19:00:54 +01:00
|
|
|
int n_output;
|
|
|
|
int n_hidden;
|
|
|
|
std::string activation;
|
|
|
|
std::string cost;
|
|
|
|
|
|
|
|
std::vector<std::vector<double>> input;
|
|
|
|
|
|
|
|
std::vector<std::vector<double>> weights;
|
|
|
|
std::vector<double> bias;
|
|
|
|
|
|
|
|
std::vector<std::vector<double>> z;
|
|
|
|
std::vector<std::vector<double>> a;
|
|
|
|
|
2023-01-24 19:23:30 +01:00
|
|
|
std::map<std::string, std::vector<std::vector<double>> (MLPPActivation::*)(std::vector<std::vector<double>>, bool)> activation_map;
|
|
|
|
std::map<std::string, std::vector<double> (MLPPActivation::*)(std::vector<double>, bool)> activationTest_map;
|
2023-01-24 19:37:08 +01:00
|
|
|
std::map<std::string, double (MLPPCost::*)(std::vector<std::vector<double>>, std::vector<std::vector<double>>)> cost_map;
|
|
|
|
std::map<std::string, std::vector<std::vector<double>> (MLPPCost::*)(std::vector<std::vector<double>>, std::vector<std::vector<double>>)> costDeriv_map;
|
2023-01-23 21:13:26 +01:00
|
|
|
|
2023-01-24 19:00:54 +01:00
|
|
|
std::vector<double> z_test;
|
|
|
|
std::vector<double> a_test;
|
|
|
|
|
|
|
|
std::vector<std::vector<double>> delta;
|
|
|
|
|
|
|
|
// Regularization Params
|
|
|
|
std::string reg;
|
|
|
|
double lambda; /* Regularization Parameter */
|
|
|
|
double alpha; /* This is the controlling param for Elastic Net*/
|
|
|
|
|
|
|
|
std::string weightInit;
|
|
|
|
|
|
|
|
void forwardPass();
|
|
|
|
void Test(std::vector<double> x);
|
|
|
|
};
|
2023-01-24 19:20:18 +01:00
|
|
|
|
2023-01-24 19:00:54 +01:00
|
|
|
|
|
|
|
#endif /* MultiOutputLayer_hpp */
|