1
0
mirror of https://github.com/sjwhitworth/golearn.git synced 2025-04-26 13:49:14 +08:00

Merge e99043d4ac7412554fc0d3ed95e79fe6fbb62ddc into 74ae077eafb245fa3bdca0288854b6d51f97fe60

This commit is contained in:
Mikael VALLENET 2023-01-05 13:45:03 +01:00 committed by GitHub
commit d781c9002e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,14 @@ var Sigmoid NeuralFunction = NeuralFunction{
func(v float64) float64 { return v * (1 - v) },
}
// TanhForward function does tanh(t) = \frac{1 - e^{-2t}}{1 + e^{-2t}}
//
// See https://en.wikipedia.org/wiki/Hyperbolic_functions
var Tanh NeuralFunction = NeuralFunction{
func(v float64) float64 { return math.Tanh(v) },
func(v float64) float64 { return 1 - (v * v) },
}
// LinearFunction doesn't modify the value
var Linear NeuralFunction = NeuralFunction{
func(v float64) float64 { return v },