Skip to content
Snippets Groups Projects
NeuronAbsolute.cpp 923 B
Newer Older

#include <boost/serialization/export.hpp>

#include "NeuronAbsolute.h"
#include "NeuronConstant.h"
#include "NeuronSerialization.h"
#include "NeuronAbsoluteSerialization.h"
#include "exceptions.h"

BOOST_CLASS_EXPORT_IMPLEMENT(lib4neuro::NeuronAbsolute);

namespace lib4neuro {
	NeuronAbsolute::NeuronAbsolute() {}

	double NeuronAbsolute::activate(double x,
		double b) {
		return this->activation_val;
	}

	double NeuronAbsolute::activation_function_eval_derivative_bias(double x,
		double b) {
		//return (x + b > 0)? 1.0 : -1.0;
		return 2 * (x + b);
	}

	double NeuronAbsolute::activation_function_eval_derivative(double x,
		double b) {
		//return (x + b > 0) ? 1.0 : -1.0;
		return 2 * (x + b);
	}


	Neuron* NeuronAbsolute::get_derivative() {//TODO: implement this function correctly
		THROW_NOT_IMPLEMENTED_ERROR("The derivative of Absolute neuron is not implemented yet");