Newer
Older
//
// Created by fluffymoo on 11.6.18.
//
#include <boost/serialization/base_object.hpp>
NeuronLinear::NeuronLinear(double a, double b) {
this->n_activation_function_parameters = 2;
this->activation_function_parameters = new double[2];
this->activation_function_parameters[0] = a;
this->activation_function_parameters[1] = b;

Michal Kravcenko
committed
this->edges_in = new std::vector<Connection*>(0);
this->edges_out = new std::vector<Connection*>(0);
void NeuronLinear::activate( ) {
double x = this->potential;
double a = this->activation_function_parameters[0];
double b = this->activation_function_parameters[1];
this->state = b * x + a;
}
double NeuronLinear::activation_function_get_partial_derivative(int param_idx) {
if(param_idx == 0){
return 1.0;
}
else if(param_idx == 1){
double x = this->potential;
return x;
}
return 0.0;
double NeuronLinear::activation_function_get_derivative( ) {
double b = this->activation_function_parameters[1];
return b;
}
//template<class Archive>
//void NeuronLinear::serialize(Archive & ar, const unsigned int version) {
// ar & boost::serialization::base_object<Neuron>(*this);
//}