Unit testing for def/ module.
Added unit tests to test code in def/ module.
This commit is contained in:
parent
e24b8a08c9
commit
bac60e872a
396 changed files with 83991 additions and 13209 deletions
18
vendor/github.com/montanaflynn/stats/sigmoid.go
generated
vendored
Normal file
18
vendor/github.com/montanaflynn/stats/sigmoid.go
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
package stats
|
||||
|
||||
import "math"
|
||||
|
||||
// Sigmoid returns the input values in the range of -1 to 1
|
||||
// along the sigmoid or s-shaped curve, commonly used in
|
||||
// machine learning while training neural networks as an
|
||||
// activation function.
|
||||
func Sigmoid(input Float64Data) ([]float64, error) {
|
||||
if input.Len() == 0 {
|
||||
return Float64Data{}, EmptyInput
|
||||
}
|
||||
s := make([]float64, len(input))
|
||||
for i, v := range input {
|
||||
s[i] = 1 / (1 + math.Exp(-v))
|
||||
}
|
||||
return s, nil
|
||||
}
|
Reference in a new issue