Something went wrong on our end
-
Michal Kravcenko authored
- Added preliminary connection classes with neural network class able to evaluate inputs via the feed-forward method. - Added a test case for validating feed-forward capabilities of our networks
Michal Kravcenko authored- Added preliminary connection classes with neural network class able to evaluate inputs via the feed-forward method. - Added a test case for validating feed-forward capabilities of our networks
NeuronLinear.cpp 977 B
//
// Created by fluffymoo on 11.6.18.
//
#include "NeuronLinear.h"
NeuronLinear::NeuronLinear(double a, double b) {
this->activation_function_parameters = new double[2];
this->activation_function_parameters[0] = a;
this->activation_function_parameters[1] = b;
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;
}