diff --git a/libs/ml/include/psemek/ml/neural_net/activation.hpp b/libs/ml/include/psemek/ml/neural_net/activation.hpp index 7c9318ad..e4d530ef 100644 --- a/libs/ml/include/psemek/ml/neural_net/activation.hpp +++ b/libs/ml/include/psemek/ml/neural_net/activation.hpp @@ -11,6 +11,7 @@ namespace psemek::ml // f'(x) = G(f(x)) for some G: R -> R enum class activation_type { + id, sigmoid, tanh, relu, @@ -28,6 +29,8 @@ namespace psemek::ml T activation(T x, activation_type type) { switch (type) { + case activation_type::id: + return x; case activation_type::sigmoid: return 1.f / (1.f + std::exp(-x)); case activation_type::tanh: @@ -43,6 +46,8 @@ namespace psemek::ml T activation_derivative(T value, activation_type type) { switch (type) { + case activation_type::id: + return T{1}; case activation_type::sigmoid: return value * (T{1} - value); case activation_type::tanh: