zlearn 0.1.1

A simple neural network implementation library in Rust
Documentation
  • Coverage
  • 0%
    0 out of 26 items documented0 out of 16 items with examples
  • Size
  • Source code size: 12.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.15 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • SouthWalker/zlearn
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • GrishmUmesh

zlearn

A simple neural network library in rust, designed for simplicity and higher control to the user.

Features

Builtin activation functions
Builtin Matrices
Backpropogation

XOR Example

use zlearn::activation::SIGMOID;
use zlearn:network::Network;

fn main() {
    // XOR input and target data
    let inputs = vec![
        vec![0.0, 0.0],
        vec![0.0, 1.0],
        vec![1.0, 0.0],
        vec![1.0, 1.0],
    ];
    let targets = vec![
        vec![0.0],
        vec![1.0],
        vec![1.0],
        vec![0.0],
    ];

    // Create a network: 2 input neurons, 2 hidden neurons, 1 output neuron
    let mut network = Network::new(vec![2, 2, 1], SIGMOID, 0.5);

    // Train the network for 10,000 epochs
    network.train(inputs.clone(), targets, 10000);

    // Test the network
    println!("\nTesting XOR after training:");
    for i in 0..inputs.len() {
        let output = network.feed_forward(inputs[i].clone());
        println!(
            "Input: [{:.1}, {:.1}]  Output: {:.3}  Expected: [{:.1}]",
            inputs[i][0], inputs[i][1], output[0], targets[i][0]
        );
    }
}