aprender/lib.rs
1//! Aprender: Next-generation machine learning library in pure Rust.
2//!
3//! Aprender provides production-grade ML algorithms with a focus on
4//! ergonomic APIs, comprehensive testing, and backend-agnostic compute.
5//!
6//! # Quick Start
7//!
8//! ```
9//! use aprender::prelude::*;
10//!
11//! // Create training data (y = 2*x + 1)
12//! let x = Matrix::from_vec(4, 1, vec![
13//! 1.0,
14//! 2.0,
15//! 3.0,
16//! 4.0,
17//! ]).unwrap();
18//! let y = Vector::from_slice(&[3.0, 5.0, 7.0, 9.0]);
19//!
20//! // Train linear regression
21//! let mut model = LinearRegression::new();
22//! model.fit(&x, &y).unwrap();
23//!
24//! // Make predictions
25//! let predictions = model.predict(&x);
26//! let r2 = model.score(&x, &y);
27//! assert!(r2 > 0.99);
28//! ```
29//!
30//! # Modules
31//!
32//! - [`primitives`]: Core Vector and Matrix types
33//! - [`data`]: DataFrame for named columns
34//! - [`linear_model`]: Linear regression algorithms
35//! - [`cluster`]: Clustering algorithms (K-Means)
36//! - [`code`]: Code analysis and code2vec embeddings
37//! - [`classification`]: Classification algorithms (Logistic Regression)
38//! - [`tree`]: Decision tree classifiers
39//! - [`metrics`]: Evaluation metrics
40//! - [`mining`]: Pattern mining algorithms (Apriori for association rules)
41//! - [`model_selection`]: Cross-validation and train/test splitting
42//! - [`preprocessing`]: Data transformers (scalers, encoders)
43//! - [`optim`]: Optimization algorithms (SGD, Adam)
44//! - [`loss`]: Loss functions for training (MSE, MAE, Huber)
45//! - [`serialization`]: Model serialization (SafeTensors format)
46//! - [`stats`]: Traditional descriptive statistics (quantiles, histograms)
47//! - [`graph`]: Graph construction and analysis (centrality, community detection)
48//! - [`bayesian`]: Bayesian inference (conjugate priors, MCMC, variational inference)
49//! - [`glm`]: Generalized Linear Models (Poisson, Gamma, Binomial families)
50//! - [`decomposition`]: Matrix decomposition (ICA, PCA)
51//! - [`text`]: Text processing and NLP (tokenization, stop words, stemming)
52//! - [`time_series`]: Time series analysis and forecasting (ARIMA)
53//! - [`index`]: Approximate nearest neighbor search (HNSW)
54//! - [`recommend`]: Recommendation systems (content-based, collaborative filtering)
55//! - [`synthetic`]: Synthetic data generation for AutoML (EDA, back-translation, MixUp)
56//! - [`bundle`]: Model bundling and memory paging for large models
57//! - [`cache`]: Cache hierarchy and model registry for large model management
58//! - [`chaos`]: Chaos engineering configuration (from renacer)
59//! - [`inspect`]: Model inspection tooling (header analysis, diff, quality scoring)
60//! - [`loading`]: Model loading subsystem with WCET and cryptographic agility
61//! - [`scoring`]: 100-point model quality scoring system
62//! - [`zoo`]: Model zoo protocol for sharing and discovery
63//! - [`embed`]: Data embedding with test data and tiny model representations
64//! - [`native`]: SIMD-native model format for zero-copy inference
65//! - [`stack`]: Sovereign AI Stack integration types
66//! - [`online`]: Online learning and dynamic retraining infrastructure
67
68pub mod active_learning;
69pub mod autograd;
70pub mod automl;
71pub mod bayesian;
72/// Model evaluation and benchmarking framework (spec §7.10)
73pub mod bench;
74pub mod bundle;
75pub mod cache;
76pub mod calibration;
77pub mod chaos;
78/// Compiler-in-the-Loop Learning (CITL) for transpiler support.
79pub mod citl;
80pub mod classification;
81pub mod cluster;
82pub mod code;
83pub mod data;
84pub mod decomposition;
85/// Data embedding with test data and tiny model representations (spec §4)
86pub mod embed;
87pub mod ensemble;
88pub mod error;
89/// Explainability wrappers for inference monitoring (entrenar integration)
90#[cfg(feature = "inference-monitoring")]
91pub mod explainable;
92pub mod format;
93pub mod glm;
94pub mod gnn;
95pub mod graph;
96/// Hugging Face Hub integration (GH-100)
97#[cfg(feature = "hf-hub-integration")]
98pub mod hf_hub;
99pub mod index;
100/// Model inspection tooling (spec §7.2)
101pub mod inspect;
102pub mod interpret;
103pub mod linear_model;
104/// Model loading subsystem with WCET and cryptographic agility (spec §7.1)
105pub mod loading;
106pub mod loss;
107pub mod metaheuristics;
108pub mod metrics;
109pub mod mining;
110pub mod model_selection;
111pub mod monte_carlo;
112/// SIMD-native model format for zero-copy Trueno inference (spec §5)
113pub mod native;
114pub mod nn;
115/// Online learning and dynamic retraining infrastructure
116pub mod online;
117pub mod optim;
118pub mod prelude;
119pub mod preprocessing;
120pub mod primitives;
121/// Model Quality Assurance module (spec §7.9)
122pub mod qa;
123pub mod recommend;
124pub mod regularization;
125/// 100-point model quality scoring system (spec §7)
126pub mod scoring;
127pub mod serialization;
128/// Sovereign AI Stack integration types (spec §9)
129pub mod stack;
130pub mod stats;
131pub mod synthetic;
132pub mod text;
133pub mod time_series;
134pub mod traits;
135pub mod transfer;
136pub mod tree;
137pub mod weak_supervision;
138/// Model zoo protocol for sharing and discovery (spec §8)
139pub mod zoo;
140
141pub use error::{AprenderError, Result};
142pub use primitives::{Matrix, Vector};
143pub use traits::{Estimator, Transformer, UnsupervisedEstimator};