pmlpp/mlpp/hidden_layer/hidden_layer.h

53 lines
1.3 KiB
C
Raw Normal View History

2023-01-24 18:57:18 +01:00
#ifndef MLPP_HIDDEN_LAYER_H
#define MLPP_HIDDEN_LAYER_H
//
// HiddenLayer.hpp
//
// Created by Marc Melikyan on 11/4/20.
//
2023-01-24 18:12:23 +01:00
#include "../activation/activation.h"
#include <map>
#include <string>
2023-01-24 19:00:54 +01:00
#include <vector>
namespace MLPP {
class HiddenLayer {
public:
HiddenLayer(int n_hidden, std::string activation, std::vector<std::vector<double>> input, std::string weightInit, std::string reg, double lambda, double alpha);
2023-01-24 19:00:54 +01:00
int n_hidden;
std::string activation;
2023-01-24 19:00:54 +01:00
std::vector<std::vector<double>> input;
2023-01-24 19:00:54 +01:00
std::vector<std::vector<double>> weights;
std::vector<double> bias;
2023-01-24 19:00:54 +01:00
std::vector<std::vector<double>> z;
std::vector<std::vector<double>> a;
2023-01-24 19:00:54 +01:00
std::map<std::string, std::vector<std::vector<double>> (Activation::*)(std::vector<std::vector<double>>, bool)> activation_map;
std::map<std::string, std::vector<double> (Activation::*)(std::vector<double>, bool)> activationTest_map;
2023-01-24 19:00:54 +01:00
std::vector<double> z_test;
std::vector<double> a_test;
2023-01-24 19:00:54 +01:00
std::vector<std::vector<double>> delta;
2023-01-24 19:00:54 +01:00
// Regularization Params
std::string reg;
double lambda; /* Regularization Parameter */
double alpha; /* This is the controlling param for Elastic Net*/
2023-01-24 19:00:54 +01:00
std::string weightInit;
2023-01-24 19:00:54 +01:00
void forwardPass();
void Test(std::vector<double> x);
};
} //namespace MLPP
#endif /* HiddenLayer_hpp */