KOSASIH / cosmic-pi-network

Undocumented public item in source code RS-D1001
Documentation
Minor
3 months ago3 months old
Undocumented public associated method
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}
Undocumented public associated method
 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();