27 lines
735 B
C++
27 lines
735 B
C++
#pragma once
|
|
|
|
#include "./ActivationFunction.h"
|
|
|
|
namespace NeuralNetwork {
|
|
namespace ActivationFunction {
|
|
|
|
class Heaviside: public ActivationFunction {
|
|
public:
|
|
Heaviside(const float &lambdaP=1.0): lambda(lambdaP) {}
|
|
|
|
inline virtual float derivatedOutput(const float &,const float &) const override { return 1.0; }
|
|
inline virtual float operator()(const float &x) const override { return x>lambda ? 1.0f : 0.0f; };
|
|
|
|
virtual ActivationFunction* clone() const override {
|
|
return new Heaviside(lambda);
|
|
}
|
|
|
|
virtual std::string stringify() const override {
|
|
return "{ \"class\": \"NeuralNetwork::ActivationFunction::Heaviside\", \"lamba\" : "+std::to_string(lambda)+"}";
|
|
}
|
|
|
|
protected:
|
|
float lambda;
|
|
};
|
|
}
|
|
} |