Skip to content
Snippets Groups Projects
NeuronAbsolute.h 1.53 KiB
                                         /**
* DESCRIPTION OF THE CLASS
*
* @author Martin Beseda
* @author Martin Mrovec
* @author Michal Kravčenko
* @date 2017 - 2018
*/

#ifndef INC_4NEURO_NEURONABSOLUTE_H
#define INC_4NEURO_NEURONABSOLUTE_H

#include "Neuron.h"

namespace lib4neuro {

	/**
	* Linear neuron class - uses activation function in the form f(x)=a*x + b,
	* 'x' being the neuron's potential
	*/
	class NeuronAbsolute : public NeuronDifferentiable {

	public:

		/**
		* Struct used to access private properties from
		* the serialization function
		*/
		struct access;

		/**
		* Constructs the object of the Linear neuron with activation function
		* f(x) = x + b
		* @param[in] b Bias
		*/
		LIB4NEURO_API explicit NeuronAbsolute();

		/**
		* Evaluates 'x + b' and stores the result into the 'state' property
		*/
		LIB4NEURO_API double activate(double x,
			double b) override;

		/**
		* Calculates the partial derivative of the activation function
		* f(x) = x + b at point x
		* @return Partial derivative of the activation function according to the
		* 'bias' parameter. Returns 1.0
		*/
		LIB4NEURO_API double activation_function_eval_derivative_bias(double x,
			double b) override;

		/**
		* Calculates d/dx of (x + b) at point x
		* @return 1.0
		*/
		LIB4NEURO_API double activation_function_eval_derivative(double x,
			double b) override;

		/**
		* Returns a pointer to a Neuron with derivative as its activation function
		* @return
		*/
		LIB4NEURO_API Neuron* get_derivative() override;

	};

}

#endif //INC_4NEURO_NeuronAbsolute_H