Skip to content
Snippets Groups Projects
NeuronLinear.cpp 750 B
Newer Older
  • Learn to ignore specific revisions
  • //
    // Created by fluffymoo on 11.6.18.
    //
    
    #include "NeuronLinear.h"
    
    Michal Kravcenko's avatar
    Michal Kravcenko committed
    NeuronLinear::NeuronLinear( double * b ) {
    
    Michal Kravcenko's avatar
    Michal Kravcenko committed
        this->bias = b;
    
    Michal Kravcenko's avatar
    Michal Kravcenko committed
    double NeuronLinear::activate( double x ) {
        double b = 0.0;
        if( this->bias ){
            b = *this->bias;
    
    Michal Kravcenko's avatar
    Michal Kravcenko committed
        return  x + b;
    
    Michal Kravcenko's avatar
    Michal Kravcenko committed
    double NeuronLinear::activation_function_eval_derivative_bias( double x ) {
        return 1.0;
    }
    
    Michal Kravcenko's avatar
    Michal Kravcenko committed
    double NeuronLinear::activation_function_eval_derivative( double x ) {
        return 1.0;
    
    Neuron* NeuronLinear::get_derivative() {
    
    Michal Kravcenko's avatar
    Michal Kravcenko committed
        NeuronConstant* output = new NeuronConstant( 1.0 );
    
    //template<class Archive>
    //void NeuronLinear::serialize(Archive & ar, const unsigned int version) {
    //    ar & boost::serialization::base_object<Neuron>(*this);
    //}