Commit ad9f6f2b authored by Pawel Sznajder's avatar Pawel Sznajder
Browse files

Merge branch 'new_channels_this_is_it' into 'master'

Partons v2

See merge request !2
parents 0ee8bfdd e3d96b13
This diff is collapsed.
1.0
\ No newline at end of file
2.0
\ No newline at end of file
/*
* NeuralNetworkTypeRegistry.h
*
* Created on: Apr 23, 2016
* Author: Pawel Sznajder
*/
#ifndef NEURAL_NETWORK_TYPE_REGISTRY_H_
#define NEURAL_NETWORK_TYPE_REGISTRY_H_
#include <map>
#include "activation_function/ActivationFunction.h"
#include "beans/ActivationFunctionType.h"
#include "beans/CombinationFunctionType.h"
#include "beans/ScalingFunctionType.h"
#include "beans/TrainingFunctionType.h"
#include "combination_function/CombinationFunction.h"
#include "scaling_function/ScalingFunction.h"
#include "training_function/TrainingFunction.h"
namespace NumA {
class NeuralNetworkTypeRegistry {
public:
virtual ~NeuralNetworkTypeRegistry();
static NeuralNetworkTypeRegistry* getInstance();
unsigned int registerActivationFunction(
const ActivationFunctionType::Type type,
ActivationFunction* const object);
unsigned int registerCombinationFunction(
const CombinationFunctionType::Type type,
CombinationFunction* const object);
unsigned int registerScalingFunction(const ScalingFunctionType::Type type,
ScalingFunction* const object);
unsigned int registerTrainingFunction(const TrainingFunctionType::Type type,
TrainingFunction* const object);
ActivationFunction* getActivationFunction(
const ActivationFunctionType::Type type) const;
CombinationFunction* getCombinationFunction(
const CombinationFunctionType::Type type) const;
ScalingFunction* getScalingFunction(
const ScalingFunctionType::Type type) const;
TrainingFunction* getTrainingFunction(
const TrainingFunctionType::Type type) const;
private:
static NeuralNetworkTypeRegistry* p_instance;
NeuralNetworkTypeRegistry();
std::map<ActivationFunctionType::Type, ActivationFunction*> m_activationFunctions;
std::map<CombinationFunctionType::Type, CombinationFunction*> m_combinationFunctions;
std::map<ScalingFunctionType::Type, ScalingFunction*> m_scalingFunctions;
std::map<TrainingFunctionType::Type, TrainingFunction*> m_trainingFunctions;
};
}
#endif /* NEURAL_NETWORK_TYPE_REGISTRY_H_ */
/*
* ActivationFunction.h
*
* Created on: Apr 23, 2016
* Author: Pawel Sznajder
*/
#ifndef ACTIVATIONFUNCTION_H_
#define ACTIVATIONFUNCTION_H_
#include <string>
namespace NumA {
class ActivationFunction {
public:
ActivationFunction();
ActivationFunction(const std::string& name);
virtual ~ActivationFunction();
virtual ActivationFunction* clone() const;
virtual double evaluate(double input);
virtual double evaluateFirstDerivative(double input);
virtual double evaluateSecondDerivative(double input);
protected:
ActivationFunction(const ActivationFunction& other);
};
}
#endif /* ACTIVATIONFUNCTION_H_ */
/*
* ActivationFunctionHyperbolic.h
*
* Created on: Apr 23, 2016
* Author: Pawel Sznajder
*/
#ifndef ACTIVATIONFUNCTIONHYPERBOLIC_H_
#define ACTIVATIONFUNCTIONHYPERBOLIC_H_
#include "ActivationFunction.h"
namespace NumA {
class ActivationFunctionHyperbolic: public ActivationFunction {
public:
static const unsigned int classId;
ActivationFunctionHyperbolic();
virtual ~ActivationFunctionHyperbolic();
virtual ActivationFunctionHyperbolic* clone() const;
virtual double evaluate(double input);
virtual double evaluateFirstDerivative(double input);
virtual double evaluateSecondDerivative(double input);
protected:
ActivationFunctionHyperbolic(const ActivationFunctionHyperbolic& other);
};
}
#endif /* ACTIVATIONFUNCTIONHYPERBOLIC_H_ */
/*
* ActivationFunctionLinear.h
*
* Created on: Apr 23, 2016
* Author: Pawel Sznajder
*/
#ifndef ACTIVATIONFUNCTIONLINEAR_H_
#define ACTIVATIONFUNCTIONLINEAR_H_
#include "ActivationFunction.h"
namespace NumA {
class ActivationFunctionLinear: public ActivationFunction {
public:
static const unsigned int classId;
ActivationFunctionLinear();
virtual ~ActivationFunctionLinear();
virtual ActivationFunctionLinear* clone() const;
virtual double evaluate(double input);
virtual double evaluateFirstDerivative(double input);
virtual double evaluateSecondDerivative(double input);
protected:
ActivationFunctionLinear(const ActivationFunctionLinear& other);
};
}
#endif /* ACTIVATIONFUNCTIONLINEAR_H_ */
/*
* ActivationFunctionLogistic.h
*
* Created on: Apr 23, 2016
* Author: Pawel Sznajder
*/
#ifndef ACTIVATIONFUNCTIONLOGISTIC_H_
#define ACTIVATIONFUNCTIONLOGISTIC_H_
#include "ActivationFunction.h"
namespace NumA {
class ActivationFunctionLogistic: public ActivationFunction {
public:
static const unsigned int classId;
ActivationFunctionLogistic();
virtual ~ActivationFunctionLogistic();
virtual ActivationFunctionLogistic* clone() const;
virtual double evaluate(double input);
virtual double evaluateFirstDerivative(double input);
virtual double evaluateSecondDerivative(double input);
protected:
ActivationFunctionLogistic(const ActivationFunctionLogistic& other);
};
}
#endif /* ACTIVATIONFUNCTIONLOGISTIC_H_ */
/*
* ActivationFunctionSymetricThreshold.h
*
* Created on: Apr 23, 2016
* Author: Pawel Sznajder
*/
#ifndef ACTIVATIONFUNCTIONSYMETRICTHRESHOLD_H_
#define ACTIVATIONFUNCTIONSYMETRICTHRESHOLD_H_
#include "ActivationFunction.h"
namespace NumA {
class ActivationFunctionSymetricThreshold: public ActivationFunction {
public:
static const unsigned int classId;
ActivationFunctionSymetricThreshold();
virtual ~ActivationFunctionSymetricThreshold();
virtual ActivationFunctionSymetricThreshold* clone() const;
virtual double evaluate(double input);
virtual double evaluateFirstDerivative(double input);
virtual double evaluateSecondDerivative(double input);
protected:
ActivationFunctionSymetricThreshold(
const ActivationFunctionSymetricThreshold& other);
};
}
#endif /* ACTIVATIONFUNCTIONSYMETRICTHRESHOLD_H_ */
/*
* ActivationFunctionThreshold.h
*
* Created on: Apr 23, 2016
* Author: Pawel Sznajder
*/
#ifndef ACTIVATIONFUNCTIONTHRESHOLD_H_
#define ACTIVATIONFUNCTIONTHRESHOLD_H_
#include "ActivationFunction.h"
namespace NumA {
class ActivationFunctionThreshold: public ActivationFunction {
public:
static const unsigned int classId;
ActivationFunctionThreshold();
virtual ~ActivationFunctionThreshold();
virtual ActivationFunctionThreshold* clone() const;
virtual double evaluate(double input);
virtual double evaluateFirstDerivative(double input);
virtual double evaluateSecondDerivative(double input);
protected:
ActivationFunctionThreshold(const ActivationFunctionThreshold& other);
};
}
#endif /* ACTIVATIONFUNCTIONTHRESHOLD_H_ */
/*
* ActivationFunctionType.h
*
* Created on: Apr 24, 2016
* Author: Pawel Sznajder
*/
#ifndef ACTIVATIONFUNCTIONTYPE_H_
#define ACTIVATIONFUNCTIONTYPE_H_
#include <string>
namespace NumA {
class ActivationFunctionType {
public:
enum Type {
UNDEFINED = 0,
Hyperbolic = 1,
Linear = 2,
Logistic = 3,
SymetricThreshold = 4,
Threshold = 5
};
ActivationFunctionType();
ActivationFunctionType(ActivationFunctionType::Type type);
ActivationFunctionType(const ActivationFunctionType& other);
virtual ~ActivationFunctionType();
ActivationFunctionType* clone() const;
std::string toString() const;
private:
ActivationFunctionType::Type m_type;
};
}
#endif /* ACTIVATIONFUNCTIONTYPE_H_ */
/*
* CombinationFunctionType.h
*
* Created on: Apr 24, 2016
* Author: Pawel Sznajder
*/
#ifndef COMBINATIONFUNCTIONTYPE_H_
#define COMBINATIONFUNCTIONTYPE_H_
#include <string>
namespace NumA {
class CombinationFunctionType {
public:
enum Type {
UNDEFINED = 0, ScalarProduct = 1
};
CombinationFunctionType();
CombinationFunctionType(CombinationFunctionType::Type type);
CombinationFunctionType(const CombinationFunctionType& other);
virtual ~CombinationFunctionType();
CombinationFunctionType* clone() const;
std::string toString() const;
private:
CombinationFunctionType::Type m_type;
};
}
#endif /* COMBINATIONFUNCTIONTYPE_H_ */
/*
* NeuralNetworkData.h
*
* Created on: May 1, 2016
* Author: Pawel Sznajder
*/
#ifndef NEURALNETWORKDATA_H_
#define NEURALNETWORKDATA_H_
#include <map>
#include <vector>
namespace NumA {
class Data {
public:
Data();
Data(unsigned int size);
Data(const Data& other);
virtual ~Data();
Data* clone() const;
unsigned int getNVariables() const;
unsigned int getNPoints() const;
const std::map<unsigned int, std::vector<double> >& getData() const;
void addData(const std::vector<double>& data);
void print() const;
void operator+=(const Data& rhs);
private:
unsigned int m_nVariables;
unsigned int m_nPoints;
std::map<unsigned int, std::vector<double> > m_data;
};
}
#endif /* NEURALNETWORKDATA_H_ */
/*
* InitializationType.h
*
* Created on: Jul 28, 2016
* Author: Pawel Sznajder
*/
#ifndef INITIALIZATIONTYPE_H_
#define INITIALIZATIONTYPE_H_
#include <string>
namespace NumA {
class InitializationType {
public:
enum Type {
UNDEFINED = 0, Static = 1, Random = 2
};
InitializationType();
InitializationType(InitializationType::Type type);
InitializationType(const InitializationType& other);
virtual ~InitializationType();
InitializationType* clone() const;
std::string toString() const;
private:
InitializationType::Type m_type;
};
}
#endif /* INITIALIZATIONTYPE_H_ */
/*
* NeuralNetworkCellPropertyType.h
*
* Created on: Apr 24, 2016
* Author: Pawel Sznajder
*/
#ifndef NEURALNETWORKCELLPROPERTYTYPE_H_
#define NEURALNETWORKCELLPROPERTYTYPE_H_
#include <string>
namespace NumA {
class NeuralNetworkCellPropertyType {
public:
enum Type {
UNDEFINED = 0,
OnlyOneInputNeuron = 1,
ManyInputNeurons = 2,
NoInputNeurons = 3,
OnlyOneOutputNeuron = 4,
ManyOutputNeurons = 5,
NoOutputNeurons = 6,
RequairesFixedInputNeuronWeights = 7,
DoNotRequairesFixedInputNeuronWeights = 8,
RequairesFixedOutputNeuronWeights = 9,
DoNotRequairesFixedOutputNeuronWeights = 10,
RequiresTraining = 11,
DoNotRequiresTraining = 12
};
NeuralNetworkCellPropertyType();
NeuralNetworkCellPropertyType(NeuralNetworkCellPropertyType::Type type);
NeuralNetworkCellPropertyType(const NeuralNetworkCellPropertyType& other);
virtual ~NeuralNetworkCellPropertyType();
NeuralNetworkCellPropertyType* clone() const;
std::string toString() const;
private:
NeuralNetworkCellPropertyType::Type m_type;
};
}
#endif /* NEURALNETWORKCELLPROPERTYTYPE_H_ */
/*
* NeuralNetworkCellType.h
*
* Created on: Apr 24, 2016
* Author: Pawel Sznajder
*/
#ifndef NEURALNETWORKCELLTYPE_H_
#define NEURALNETWORKCELLTYPE_H_
#include <string>
namespace NumA {
class NeuralNetworkCellType {
public:
enum Type {
UNDEFINED = 0,
InputCell = 1,
OutputCell = 2,
ScalingCell = 3,
Perceptron = 4,
TransitionCell = 5
};
NeuralNetworkCellType();
NeuralNetworkCellType(NeuralNetworkCellType::Type type);
NeuralNetworkCellType(const NeuralNetworkCellType& other);
virtual ~NeuralNetworkCellType();
NeuralNetworkCellType* clone() const;
std::string toString() const;
private:
NeuralNetworkCellType::Type m_type;
};
}
#endif /* NEURALNETWORKCELLTYPE_H_ */
/*
* ScalingFunctionType.h
*
* Created on: Apr 24, 2016
* Author: Pawel Sznajder
*/
#ifndef SCALINGFUNCTIONTYPE_H_
#define SCALINGFUNCTIONTYPE_H_
#include <string>
namespace NumA {
class ScalingFunctionType {
public:
enum Type {
UNDEFINED = 0, NoScaling = 1, MeanStdDeviation = 2, MinMax = 3
};
ScalingFunctionType();
ScalingFunctionType(ScalingFunctionType::Type type);
ScalingFunctionType(const ScalingFunctionType& other);
virtual ~ScalingFunctionType();
ScalingFunctionType* clone() const;
std::string toString() const;