pmlpp/mlpp/multi_output_layer/multi_output_layer.h

61 lines
1.7 KiB
C
Raw Normal View History

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