- added Stack::setName()
git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@668 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+73
-72
@@ -1,72 +1,73 @@
|
||||
/*
|
||||
* 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 <string>
|
||||
#include <vector>
|
||||
#include <armadillo>
|
||||
#include <jsoncpp/json/json.h>
|
||||
#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 &dir, 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(Rbm::IListener* pListener);
|
||||
bool load(LayerConstructor *pLayerConstructor=nullptr);
|
||||
bool save();
|
||||
void weightsInit(double stddev);
|
||||
bool loadWeights();
|
||||
bool saveWeights();
|
||||
|
||||
size_t numTraining();
|
||||
void addTraining(const arma::mat &toAdd);
|
||||
void delTraining(int index);
|
||||
size_t loadTraining(bool doNormalize=false);
|
||||
size_t saveTraining();
|
||||
arma::mat& trainingData();
|
||||
arma::mat trainingData(Layer *pLayer);
|
||||
|
||||
private:
|
||||
std::string m_dir;
|
||||
std::string m_name;
|
||||
Layer *m_pLayers;
|
||||
arma::mat m_trainingData;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /* STACK_HPP */
|
||||
|
||||
/*
|
||||
* 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 <string>
|
||||
#include <vector>
|
||||
#include <armadillo>
|
||||
#include <jsoncpp/json/json.h>
|
||||
#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 &dir, const std::string &name);
|
||||
Stack(const Stack& orig);
|
||||
virtual ~Stack();
|
||||
|
||||
void setName(const std::string &name);
|
||||
size_t numLayers();
|
||||
void addLayer(Layer *pLayer);
|
||||
void delLayer(Layer *pLayer);
|
||||
Layer* getLayer(size_t layerId) const;
|
||||
|
||||
void train(Rbm::IListener* pListener);
|
||||
bool load(LayerConstructor *pLayerConstructor=nullptr);
|
||||
bool save();
|
||||
void weightsInit(double stddev);
|
||||
bool loadWeights();
|
||||
bool saveWeights();
|
||||
|
||||
size_t numTraining();
|
||||
void addTraining(const arma::mat &toAdd);
|
||||
void delTraining(int index);
|
||||
size_t loadTraining(bool doNormalize=false);
|
||||
size_t saveTraining();
|
||||
arma::mat& trainingData();
|
||||
arma::mat trainingData(Layer *pLayer);
|
||||
|
||||
private:
|
||||
std::string m_dir;
|
||||
std::string m_name;
|
||||
Layer *m_pLayers;
|
||||
arma::mat m_trainingData;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /* STACK_HPP */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user