Newer
Older

Michal Kravcenko
committed
/**
* DESCRIPTION OF THE CLASS
*
* @author Martin Beseda
* @author Martin Mrovec
* @author Michal Kravčenko
* @date 2017 - 2018
*/

Michal Kravcenko
committed
#ifndef NEURON_H_
#define NEURON_H_
#include <boost/serialization/base_object.hpp>

Michal Kravcenko
committed
#include <vector>

Michal Kravcenko
committed
/**
* Abstract class representing a general neuron
*/
friend class boost::serialization::access;

Michal Kravcenko
committed
template<class Archive>
void serialize(Archive & ar, const unsigned int version){
//TODO separate implementation to Neuron.cpp!
// ar & this->potential;
// ar & this->state;
//
// for(unsigned short int i = 0; i < this->n_activation_function_parameters; i++) {
// ar & this->activation_function_parameters[i];
// }
public:
/**
* Destructor of the Neuron object
* this level deallocates the array 'activation_function_parameters'

Michal Kravcenko
committed
* also deallocates the OUTGOING connections
*/
virtual ~Neuron();
/**
* Performs the activation function and returns the result

Michal Kravcenko
committed
*/

Michal Kravcenko
committed
virtual double activate( double x, double b ) = 0;
}; /* end of Neuron class */
Martin Beseda
committed
/**

Michal Kravcenko
committed
* Class serving as an interface providing 'activation_function_eval_partial_derivative',
* 'activation_function_eval_derivative', 'get_partial_derivative' and
* 'get_derivative' methods.
Martin Beseda
committed
*/
class IDifferentiable {
/**
* Calculates the derivative with respect to the argument, ie the 'potential'
* @return f'(x), where 'f(x)' is the activation function and 'x' = 'potential'
*/

Michal Kravcenko
committed
virtual double activation_function_eval_derivative( double x, double b ) = 0;
/**
* Calculates the derivative with respect to the bias
* @return d/db f'(x), where 'f(x)' is the activation function, 'x' is the 'potential'
* and 'b' is the bias
*/

Michal Kravcenko
committed
virtual double activation_function_eval_derivative_bias( double x, double b ) = 0;

Michal Kravcenko
committed
/**
* Returns a Neuron pointer object with activation function being the partial derivative of
* the activation function of this Neuron object with respect to the argument, i.e. 'potential'
* @return
*/

Michal Kravcenko
committed
Martin Beseda
committed
}; /* end of IDifferentiable class */
#endif /* NEURON_H_ */