File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ pub fn softmax(values: &[f64]) -> Vec<f64> {
24
24
exps. iter ( ) . map ( |& exp_val| exp_val / sum_exps) . collect ( )
25
25
}
26
26
27
- pub fn heavyside ( x : f64 ) -> f64 {
27
+ pub fn binary_step ( x : f64 ) -> f64 {
28
28
if x >= 0.0 {
29
29
1.0
30
30
} else {
Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ fn test_softmax() {
47
47
}
48
48
49
49
#[ test]
50
- fn test_heavyside ( ) {
51
- assert_eq ! ( heavyside ( -1.0 ) , 0.0 ) ;
52
- assert_eq ! ( heavyside ( 0.0 ) , 1.0 ) ;
53
- assert_eq ! ( heavyside ( 1.0 ) , 1.0 ) ;
50
+ fn test_binary_step ( ) {
51
+ assert_eq ! ( binary_step ( -1.0 ) , 0.0 ) ;
52
+ assert_eq ! ( binary_step ( 0.0 ) , 1.0 ) ;
53
+ assert_eq ! ( binary_step ( 1.0 ) , 1.0 ) ;
54
54
}
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ fn test_layer_forward() {
12
12
13
13
let perceptron = Layer {
14
14
neurons : vec ! [ neuron] ,
15
- activation : heavyside ,
15
+ activation : binary_step ,
16
16
} ;
17
17
18
18
assert_eq ! ( perceptron. forward( ) , vec![ 1.0 ] )
You can’t perform that action at this time.
0 commit comments