1 unstable release
0.0.1 | Mar 21, 2023 |
---|
#6 in #neuron
32KB
691 lines
Cerebral
Warning: Under construction
A package for composable algorithms for self-organizing neural networks for research purposes.
lib.rs
:
Naming convenctions
- traits: Start with capital letter and are adjectives
- structs: Start with capital letter and are substantives
use som_rs::default::*;
use som_rs::{NeuralLayer, Neurons, SelfOrganizing};
fn main() {
println!("Hello, SOM!");
let seed = 42;
let mut rng = Isaac64Rng::seed_from_u64(seed);
let mut som = NeuralLayer {
neurons: Neurons {
// lateral: Array2::<f64>::zeros((0,0)),
patterns: Array::random_using((100, 3), Uniform::new(0., 10.), &mut rng),
..Default::default()
},
adaptivity: KohonenAdaptivity {},
topology: CartesianTopology::new((10, 10)),
responsiveness: CartesianResponsiveness {},
training: BatchTraining {
radii: (2.0, 0.2),
rates: (0.7, 0.1),
epochs: 1,
},
};
println!("{}", som.neurons.lateral);
som.init_lateral();
let training = Array::random_using((5000, 2), Uniform::new(0., 9.), &mut rng);
som.train(&training);
som.adapt(&training.row(0), 0.7, 0.7);
}
Dependencies
~2.5MB
~52K SLoC