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