Crates.io | hextral |
lib.rs | hextral |
version | 0.3.0 |
source | src |
created_at | 2024-03-14 22:21:06.743007 |
updated_at | 2024-03-17 14:21:20.356102 |
description | Six dimensional Neural Network testing. Has Laplace and quantum fourier transform capabilities. |
homepage | |
repository | |
max_upload_size | |
id | 1174213 |
size | 9,104 |
Hextral is a Rust library for implementing a neural network with regularization techniques such as L2 and L1 regularization.
Add this crate to your Cargo.toml
:
[dependencies]
hextral = "0.1.0"
Then, you can use Hextral in your Rust project as follows:
use hextral::{Hextral, ActivationFunction, Regularization};
use nalgebra::{DVector, DMatrix};
fn main() {
// Create a new Hextral neural network
let mut hextral = Hextral::new(0.1, 0.2);
// Generate training data (inputs and targets)
let inputs = vec![
DVector::from_iterator(10, (0..10).map(|_| rand::random::<f64>())),
// Add more input vectors as needed
];
let targets = vec![
DVector::from_iterator(10, (0..10).map(|_| rand::random::<f64>())),
// Add corresponding target vectors as needed
];
// Train the neural network
hextral.train(&inputs, &targets, 0.01, Regularization::L2(0.001), 100);
// Make predictions
let input = DVector::from_iterator(10, (0..10).map(|_| rand::random::<f64>()));
let prediction = hextral.predict(&input);
println!("Prediction: {:?}", prediction);
// Evaluate the model
let evaluation_loss = hextral.evaluate(&inputs, &targets);
println!("Evaluation Loss: {}", evaluation_loss);
}
For more details on the available methods and options, please refer to the documentation.
This project is licensed under the MIT License - see the LICENSE file for details.