Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "Layer.h"
- #include "Score_Func.h"
- #include <Eigen/Eigen>
- #include <EigenRand/EigenRand>
- #include <cmath>
- #include <iostream>
- #include <random>
- #include <utility>
- namespace network {
- struct Values {
- using MatrixXd = Eigen::MatrixXd;
- template <class T> using vector = std::vector<T>;
- vector<MatrixXd> in;
- vector<MatrixXd> out;
- };
- class Network {
- template <class T> using vector = std::vector<T>;
- public:
- using MatrixXd = Eigen::MatrixXd;
- using VectorXd = Eigen::VectorXd;
- using PermutationMatrix =
- Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic>;
- Network(std::initializer_list<int> dimensions,
- std::initializer_list<Threshold_Id> threshold_id);
- Values Forward_Prop(const MatrixXd &start_vec);
- VectorXd Back_Prop(const MatrixXd &start_vec, const MatrixXd &reference,
- const Score_Func &score_func, double coef);
- VectorXd Back_Prop_SGD(const MatrixXd &start_batch, const MatrixXd &reference,
- const Score_Func &score_func, int iter_num);
- VectorXd Back_Prop_MBGD(const MatrixXd &start_batch,
- const MatrixXd &reference,
- const Score_Func &score_func, int iter_num);
- void TrainSGD(const MatrixXd &start_batch, const MatrixXd &reference,
- const Score_Func &score_func, double needed_accuracy,
- int max_epochs);
- void TrainBGD(const MatrixXd &start_batch, const MatrixXd &reference,
- const Score_Func &score_func, int cols_in_minibatch,
- double needed_accuracy, int max_epochs);
- private:
- static VectorXd Cols_Mean(const MatrixXd &x);
- vector<Layer> layers_;
- vector<Threshold_Id> threshold_id_;
- inline static std::minstd_rand index_generator;
- };
- } // namespace network
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement