Skip to content
Snippets Groups Projects
NeuronBinary.cpp 773 B
Newer Older
  • Learn to ignore specific revisions
  • //
    // Created by fluffymoo on 11.6.18.
    //
    
    #include "NeuronBinary.h"
    
    
    Neuron* NeuronBinary::get_copy( ){
        NeuronBinary* output = new NeuronBinary( this->activation_function_parameters[0] );
    
        return output;
    }
    
    
    NeuronBinary::NeuronBinary(double threshold) {
    
        this->n_activation_function_parameters = 2;
    
        this->activation_function_parameters = new double[1];
        this->activation_function_parameters[0] = threshold;
    
    
        this->edges_in = new std::vector<Connection*>(0);
        this->edges_out = new std::vector<Connection*>(0);
    
    void NeuronBinary::activate( ) {
    
        double x = this->potential;
        double threshold = this->activation_function_parameters[0];
    
        if(x >= threshold){
    
            this->state = 1.0;
        }
        else{
            this->state = 0.0;
        }
    }