Newer
Older
//
// Created by martin on 7/15/18.
//
#ifndef INC_4NEURO_ERRORFUNCTION_H
#define INC_4NEURO_ERRORFUNCTION_H
kra568
committed
#include "../settings.h"
#include "../Network/NeuralNetwork.h"
#include "../DataSet/DataSet.h"

Michal Kravcenko
committed
#include "exprtk.hpp"

Michal Kravcenko
committed
enum ErrorFunctionType{
ErrorFuncMSE
};

Michal Kravcenko
committed
public:
/**
*
* @param weights
* @return
*/
virtual double eval(std::vector<double>* weights = nullptr) = 0;
kra568
committed
LIB4NEURO_API virtual size_t get_dimension();
};
class MSE : public ErrorFunction {
public:
/**
* Constructor for single neural network
* @param net
* @param ds
*/
kra568
committed
LIB4NEURO_API MSE(NeuralNetwork* net, DataSet* ds);
/**
*
* @param weights
* @return
*/
kra568
committed
LIB4NEURO_API virtual double eval(std::vector<double>* weights = nullptr);
private:
NeuralNetwork* net;
DataSet* ds;
public:
/**
*
*/
kra568
committed
LIB4NEURO_API ErrorSum();
/**
*
*/
kra568
committed
LIB4NEURO_API ~ErrorSum();
/**
*
* @param weights
* @return
*/
kra568
committed
LIB4NEURO_API virtual double eval(std::vector<double>* weights = nullptr);
/**
*
* @param F
*/

Michal Kravcenko
committed
LIB4NEURO_API void add_error_function( ErrorFunction *F, double alpha = 1.0 );
kra568
committed
LIB4NEURO_API size_t get_dimension() override;
private:
std::vector<double> *summand_coefficient;
};
#endif //INC_4NEURO_ERRORFUNCTION_H