aprender
Next Generation Machine Learning, Statistics and Deep Learning in PURE Rust
Overview
Aprender is a lightweight, pure Rust machine learning library designed for efficiency and ease of use. Built with EXTREME TDD methodology, it provides reliable implementations of core ML algorithms with comprehensive test coverage.
Features
Core Primitives
- Vector - 1D numerical array with statistical operations (mean, sum, dot, norm, variance)
- Powered by trueno v0.2.2 for SIMD acceleration
- Matrix - 2D numerical array with linear algebra (matmul, transpose, Cholesky decomposition)
- SIMD-optimized operations via trueno backend
- DataFrame - Named column container for ML data preparation workflows
Machine Learning Models
- LinearRegression - Ordinary Least Squares via normal equations
- KMeans - K-means++ initialization with Lloyd's algorithm
- DecisionTreeClassifier - GINI-based decision tree with configurable max depth
- RandomForestClassifier - Bootstrap aggregating ensemble with majority voting
Model Selection & Evaluation
- train_test_split - Random train/test splitting with reproducible seeds
- KFold - K-fold cross-validator with optional shuffling
- cross_validate - Automated cross-validation with statistics (mean, std, min, max)
Model Persistence
- Serialization - Save/load models to disk (serde + bincode)
- Works with all models: LinearRegression, KMeans, DecisionTree, RandomForest
Metrics
- Regression:
r_squared,mse,rmse,mae - Clustering:
silhouette_score,inertia
Installation
Add to your Cargo.toml:
[]
= "0.2.0"
Quick Start
Linear Regression
use *;
K-Means Clustering
use *;
Random Forest Classification
use *;
use RandomForestClassifier;
Cross-Validation
use *;
use ;
Examples
Run the included examples:
Quality Metrics
- TDG Score: 93.3/100 (A grade)
- Total Tests: 184 passing
- Property Tests: 22 (proptest)
- Doc Tests: 16
- Coverage: ~97%
- Max Cyclomatic Complexity: ≤10
- Clippy Warnings: 0
Documentation
- EXTREME TDD Book: https://paiml.github.io/aprender/
- API Reference: Run
cargo doc --openor visit docs.rs/aprender
Roadmap
See ROADMAP.md for planned features and version roadmap.
License
MIT License - see LICENSE for details.
Contributing
Contributions welcome! Please ensure:
- All tests pass:
cargo test --all - No clippy warnings:
cargo clippy --all-targets - Code is formatted:
cargo fmt