/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: Stack.hpp * Author: jens * * Created on 25. Oktober 2019, 18:26 */ #ifndef STACK_HPP #define STACK_HPP #include #include #include #include #include "Layer.hpp" class LayerConstructor { public: LayerConstructor() {} virtual ~LayerConstructor() {} virtual Layer* onConstruct(const std::string &name, size_t id, size_t numVisibleX, size_t numVisibleY, size_t numHidden) { return nullptr; } }; class Stack { public: Stack(const std::string &name); Stack(const Stack& orig); virtual ~Stack(); size_t numLayers(); void addLayer(Layer *pLayer); void delLayer(Layer *pLayer); Layer* getLayer(size_t layerId) const; void train(size_t layerId, const arma::mat& batch, Rbm::IListener* pListener); void train(const arma::mat& batch, Rbm::IListener* pListener); bool load(LayerConstructor *pLayerConstructor=nullptr); bool save(); void weightsInit(double stddev); bool loadWeights(); bool saveWeights(); static size_t numTraining(const arma::mat &batch); static void addTraining(arma::mat &batch, const arma::mat &toAdd); static void delTraining(arma::mat &batch, int index); arma::mat loadTraining(); private: std::string m_name; Layer *m_pLayers; }; #endif /* STACK_HPP */