Expand description
§Iron Learn - A Rust Machine Learning Library
A pure Rust, type-safe machine learning library in pure Rust with GPU acceleration. Provides tensor operations, gradient-based optimization, and support for complex-valued computations.
§Key Features
- GPU-Accelerated Training: CUDA kernels for efficient large-scale optimization
- Type Safety: All operations return
Resulttypes; no unwrap-induced panics - Zero-Copy Borrowing: Compute without unnecessary allocations
- Generic Numerics: Works with f64, f32, i32, i64, Complex, and custom types
- Automatic Preprocessing: Feature normalization and bias handling built-in
§Modules
tensor: Core multi-dimensional array operationscomplex: Complex number arithmeticnumeric: Generic type system for computationsgradient_descent: CPU optimization algorithmsgpu_regression: CUDA-accelerated trainingregression: High-level training interfaceapp_context: Global application state
§Quick Example
use iron_learn::{Tensor, linear_regression};
let x = Tensor::new(vec![10, 3], vec![/* data */])?;
let y = Tensor::new(vec![10, 1], vec![/* labels */])?;
let mut w = Tensor::new(vec![4, 1], vec![0.0; 4])?;
for _ in 0..1000 {
w = linear_regression(&x, &y, &w, 0.01)?;
}§Version
0.5.0 - GPU-Accelerated Release
Structs§
- AppContext
- Global application context with training configuration and GPU capabilities
- Complex
- A complex number represented by real and imaginary components
- Data
- Container for complete dataset with both linear and logistic regression splits
- Tensor
- The
Tensorstructure is the cornerstone of this library, providing a comprehensive suite of mathematical operations for the manipulation of multidimensional data. - XY
- Training and test data container for regression tasks
Statics§
- GLOBAL_
CONTEXT - Global singleton instance of application context
Traits§
- Numeric
- The
Numerictrait defines a set of operations that numeric types must support. It includes basic arithmetic operations and the ability to return special values like zero and one.
Functions§
- gradient_
descent - Core gradient descent optimization algorithm
- init_
context - Initialize the global application context
- linear_
regression - Linear regression with automatic preprocessing
- logistic_
regression - Logistic regression with automatic preprocessing
- predict_
linear - Prediction function for linear regression
- predict_
logistic - Prediction function for logistic regression
- run_
linear - Trains and evaluates linear regression model
- run_
logistic - Trains and evaluates logistic regression model
- run_
logistics_ cuda - Main GPU training function for logistic regression Implements gradient descent using CUDA kernels for efficient computation Returns accuracy metrics on test set upon completion