10 Self { learning_rate, time_window }
11 }
12
13 pub fn update_weights(&self, weights: &mut Array2<f32>, pre_synaptic: &Array2<f32>, post_synaptic: &Array2<f32>) {14 // STDP weight update rule15 // ...16 }17}
6}
7
8impl STDP {
9 pub fn new(learning_rate: f32, time_window: f32) -> Self {10 Self { learning_rate, time_window }11 }12
13 pub fn update_weights(&self, weights: &mut Array2<f32>, pre_synaptic: &Array2<f32>, post_synaptic: &Array2<f32>) {
14 // STDP weight update rule
1use ndarray::prelude::*;
2
3pub struct STDP { 4 pub learning_rate: f32, 5 pub time_window: f32, 6} 7
8impl STDP {
9 pub fn new(learning_rate: f32, time_window: f32) -> Self {
12 Self { layers, learning_rate }
13 }
14
15 pub fn initialize_weights(&self) -> Vec<Array2<f32>> {16 let mut weights = Vec::new();17 for i in 0..self.layers.len() - 1 {18 let weight = Array2::random((self.layers[i], self.layers[i + 1]), Uniform::new(-1.0, 1.0));19 weights.push(weight);20 }21 weights22 }23}
8}
9
10impl DeepNeuralNetwork {
11 pub fn new(layers: Vec<usize>, learning_rate: f32) -> Self {12 Self { layers, learning_rate }13 }14
15 pub fn initialize_weights(&self) -> Vec<Array2<f32>> {
16 let mut weights = Vec::new();
All language items that are publicly exposed must be documented. Providing
documentation through comments or the #[doc]
attribute allows other developers
to conveniently understand the code and use the modules or crates appropriately.
Contrary to rustdoc
, this issue is also raised on all non-private items.
If an item has been marked pub
, pub(crate)
, or pub(path)
, it indicates
the possibility of usage outside the same module, and hence would ideally require
documentation, despite not being exposed outside the crate.