Crates.io | wisard |
lib.rs | wisard |
version | 0.0.3 |
source | src |
created_at | 2023-05-29 04:09:43.964618 |
updated_at | 2024-01-28 21:14:13.772249 |
description | WiSARD nets implementation in Rust |
homepage | |
repository | https://github.com/leonardohn/wisard |
max_upload_size | |
id | 876898 |
size | 63,299 |
wisard
- A library for WiSARD nets in RustWiSARD (Wilkie, Stonham, Aleksander Recognition Device) is an alternative, weightless type of neural network known for its high-speed pattern recognition capabilities and simplicity. This project is a Rust implementation of WiSARD nets, providing a lightweight, efficient, and user-friendly library for building, training, and evaluating models.
This implementation aims to harness the language's performance, safety, and concurrency features, to make it ideal for both research and production-grade applications. We aim to provide a flexible and extensible foundation for developing pattern recognition systems that can be deployed in various domains such as image recognition and signal processing.
Please note that this is a work in progress and it is not yet ready to be used in production environments.
To use WiSARD in your Rust project, add the following line to your Cargo.toml
file:
[dependencies]
wisard = "0.0.1"
For additional installation options and guidance, please refer to the crate documentation.
Here's a simple example demonstrating how to create and train a basic WiSARD
model using the wisard
crate:
use std::collections::HashSet;
use bitvec::prelude::*;
use wisard::model::BinaryWisard;
fn main() {
// The size of the input (in bits)
let input_size = 8;
// The size of the address (in bits)
let addr_size = 2;
// The set of labels used by the samples
let labels = HashSet::from_iter(vec!["cold", "hot"].into_iter());
// Create a new WiSARD model
let mut model = BinaryWisard::new(input_size, addr_size, labels);
// Provide some sample data
let samples = vec![
(bitvec![1, 1, 1, 0, 0, 0, 0, 0], "cold"),
(bitvec![1, 1, 1, 1, 0, 0, 0, 0], "cold"),
(bitvec![0, 0, 0, 0, 1, 1, 1, 1], "hot"),
(bitvec![0, 0, 0, 0, 0, 1, 1, 1], "hot"),
];
// Instantiate the samples
let samples = samples
.into_iter()
.map(|(v, l)| Sample::from_raw_parts(v, addr_size, l))
.collect::<Vec<_>>();
// Train the model using each provided sample
for sample in encoded_samples.iter() {
model.fit(sample);
}
// Display the model predictions
for sample in encoded_samples.iter() {
let input = sample.raw_bits();
let true = sample.label();
let pred = model.predict(sample);
println!("Input: {input:?}, True: {true:?}, Pred: {pred:?}");
}
}
For more detailed examples and usage instructions, please consult the documentation.
Contributions to the wisard
project are welcome! If you find a bug or have
suggestions for improvements, please open an
Issue.
Pull requests for new features,
bug fixes, and documentation enhancements are also appreciated.
wisard
is distributed under the terms of both the MIT license and the
Apache License (Version 2.0). See LICENSE-APACHE and
LICENSE-MIT for details. Opening a pull request is
assumed to signal agreement with these licensing terms.