Skip to content

Commit c4eb399

Browse files
committed
Rename heavyside to binary_step
1 parent 96d5295 commit c4eb399

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

rust/src/ai/activation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn softmax(values: &[f64]) -> Vec<f64> {
2424
exps.iter().map(|&exp_val| exp_val / sum_exps).collect()
2525
}
2626

27-
pub fn heavyside(x: f64) -> f64 {
27+
pub fn binary_step(x: f64) -> f64 {
2828
if x >= 0.0 {
2929
1.0
3030
} else {

rust/tests/ai/activation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ fn test_softmax() {
4747
}
4848

4949
#[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);
5454
}

rust/tests/ai/layer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn test_layer_forward() {
1212

1313
let perceptron = Layer {
1414
neurons: vec![neuron],
15-
activation: heavyside,
15+
activation: binary_step,
1616
};
1717

1818
assert_eq!(perceptron.forward(), vec![1.0])

0 commit comments

Comments
 (0)