Module models

Source
Expand description

Lightweight machine‑learning models built on matrices.

Models are intentionally minimal and operate on the Matrix type for inputs and parameters.

use rustframe::compute::models::linreg::LinReg;
use rustframe::matrix::Matrix;

let x = Matrix::from_vec(vec![1.0, 2.0, 3.0, 4.0], 4, 1);
let y = Matrix::from_vec(vec![2.0, 3.0, 4.0, 5.0], 4, 1);
let mut model = LinReg::new(1);
model.fit(&x, &y, 0.01, 1000);
let preds = model.predict(&x);
assert_eq!(preds.rows(), 4);

Modules§

activations
Common activation functions used in neural networks.
dense_nn
A minimal dense neural network implementation for educational purposes.
gaussian_nb
Gaussian Naive Bayes classifier for dense matrices.
k_means
Simple k-means clustering working on Matrix data.
linreg
Ordinary least squares linear regression.
logreg
Binary logistic regression classifier.
pca
Principal Component Analysis using covariance matrices.