NeuralNet 1.0
Loading...
Searching...
No Matches
Sigmoid.hpp
1#pragma once
2
3#include "Activation.hpp"
4
5namespace NeuralNet {
6class Sigmoid : public Activation {
7 public:
8 static Eigen::MatrixXd activate(const Eigen::MatrixXd &z) {
9 Eigen::MatrixXd negZ = -z;
10 return 1 / (1 + negZ.array().exp());
11 };
12
13 static Eigen::MatrixXd diff(const Eigen::MatrixXd &a) {
14 return a.array() * (1.0 - a.array());
15 };
16
17 static inline std::string slug = "sig";
18};
19} // namespace NeuralNet
Definition Activation.hpp:6
Definition Sigmoid.hpp:6