Skip to content

moh-dev-stack/ml_in_rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ml_in_rust

A lightweight, from-scratch machine learning toolkit in Rust.

Features

  • Linear Algebra: Vector struct for basic operations (dot, scale, add, sub, zeros).

  • Models:

    • Linear Regression (batch gradient descent, feature normalization)
    • Logistic Regression (sigmoid, cross-entropy, classification)
  • Preprocessing:

    • one_hot_encoding: convert categorical columns to binary matrix
    • impute: mean imputation for missing numeric values
    • scale: standard (zero-mean/unit-variance) and min-max scaling
    • split: train/test and k-fold splitting of indices
  • CSV Loading: parse CSV files into mixed-type map or numeric-only map

  • Demos:

    • linear_regression_demo
    • logistic_regression_demo

Installation

# Clone the repository
git clone [email protected]:moh-dev-stack/ml_in_rust.git
cd ml_in_rust
# Build the library and demos
cargo build --release

Usage

As a library

Add to your Cargo.toml:

[dependencies]
ml_in_rust = { git = "https://github.com/moh-dev-stack/ml_in_rust" }

Then in your code:

use ml_in_rust::algebra::vector::Vector;
use ml_in_rust::models::linear_regression::gradient_descent;
// ...

Running the demos

# Linear regression demo
cargo run --bin linear_regression_demo

# Logistic regression demo
cargo run --bin logistic_regression_demo

Project Structure

src/
├─ algebra/           # Vector and linear algebra primitives
├─ models/            # Machine learning algorithms
│  ├─ linear_regression.rs
│  └─ logistic_regression.rs
├─ preprocessing/     # Feature-engineering utilities
│  ├─ one_hot_encoding.rs
│  ├─ impute.rs
│  ├─ scale.rs
│  └─ split.rs
├─ utils/             # CSV loading and parsing
└─ bin/               # Example binaries
   ├─ linear_regression_demo.rs
   └─ logistic_regression_demo.rs

tests/                # Integration tests for each module

Testing

Run the full test suite with:

cargo test

License

This project is open source under the MIT License. See LICENSE for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages