-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract activation impls into separate module (#51)
- Loading branch information
1 parent
333e2f0
commit b2cc29f
Showing
4 changed files
with
22 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/// The sigmoid activation function. | ||
pub fn sigmoid(n: f32) -> f32 { | ||
1. / (1. + std::f32::consts::E.powf(-n)) | ||
} | ||
|
||
/// The ReLU activation function. | ||
pub fn relu(n: f32) -> f32 { | ||
n.max(0.) | ||
} | ||
|
||
/// Activation function that does nothing. | ||
pub fn linear_activation(n: f32) -> f32 { | ||
n | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
pub mod activation; | ||
pub mod neuralnet; | ||
|
||
pub use activation::*; | ||
pub use activation::{*, fns::*}; | ||
pub use neuralnet::*; | ||
|
||
pub use genetic_rs; | ||
pub use genetic_rs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters