Skip to content
Snippets Groups Projects
NeuronConstant.h 1.54 KiB
Newer Older
  • Learn to ignore specific revisions
  • /**
     * DESCRIPTION OF THE FILE
     *
     * @author Michal Kravčenko
     * @date 8.8.18 -
     */
    
    #ifndef INC_4NEURO_NEURONCONSTANT_H
    #define INC_4NEURO_NEURONCONSTANT_H
    
    
    Michal Kravcenko's avatar
    Michal Kravcenko committed
    #include "Neuron.h"
    
        class NeuronConstant : public NeuronDifferentiable {
    
        private:
            double p = 0.0;
    
        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) = c
             * @param[in] c Constant value
             */
            LIB4NEURO_API explicit NeuronConstant(double c = 0.0);
    
            /**
             * Evaluates and returns 'c'
             */
            LIB4NEURO_API double activate(double x, double b) override;
    
            /**
             * Calculates the partial derivative of the activation function
             * f(x) = c at point x
             * @return Partial derivative of the activation function according to the
             * 'bias' parameter. Returns 0.0
             */
            LIB4NEURO_API double activation_function_eval_derivative_bias(double x, double b) override;
    
            /**
             * Calculates d/dx of (c) at point x
             * @return 0.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;
        };
    
    }