Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

RustyML

> 编程语言
Open source

A high-performance machine learning library in pure Rust, offering statistical utilities, ML algorithms and neural networks.

341 stars0 likes0 views
WebsiteGitHub

About

A high-performance machine learning library in pure Rust, offering statistical utilities, ML algorithms and neural networks.

简体中文 | English

RustyML

A machine learning and deep learning library written in pure Rust.

Read RustyML User Guide for detailed documentation and tutorials of RustyML.

Overview

RustyML is a machine learning and deep learning library, built end to end in Rust with no C or C++ dependencies. It covers the full workflow: data preprocessing, feature engineering, model training, and evaluation. It uses Rust's memory safety, safe concurrency, and zero-cost abstractions.

Highlights

  • Pure Rust, no FFI: memory-safe and portable, with nothing to link against.
  • Parallelized by default: heavy kernels use Rayon for multi-threaded computation.
  • Algorithm coverage: classical supervised and unsupervised learning, anomaly detection, and a neural-network framework with a sequential model and a graph model.
  • Reproducible: a single set_global_seed call makes every randomized component on the calling thread deterministic. A per-component random_state covers the rest.
  • Model persistence: save and load trained models and network weights as compact binary, using Serde and postcard.
  • Evaluation metrics: regression, classification (binary and multiclass), and clustering, matching scikit-learn conventions.

Installation

Add RustyML to your Cargo.toml:

toml
[dependencies]
rustyml = "*"
ndarray = "0.17"

To slim the build, opt out of the default and name what you need:

# Everything (ml, nn, utils, metrics, math)
rustyml = "*"

# Just the neural-network framework
rustyml = { version = "*", default-features = false, features = ["neural_network"] }

# Just the evaluation metrics
rustyml = { version = "*", default-features = false, features = ["metrics"] }

# Show training progress bars in the terminal
rustyml = { version = "*", features = ["show_progress"] }

MSRV: Rust 1.89+ (edition 2024).

Quick Start

Classical Machine Learning

…

Neural Networks

…

Graph Models

A sequential model gives every layer 1 input, and that input is the output of the layer before it. GraphBuilder removes that limit. A node is 1 call of 1 layer on the outputs of other nodes. A model can therefore hold several inlets, several outlets, a shared tower, or a residual connection. The merge family joins the branches: Add, Subtract, Multiply, Average, Maximum, Minimum, and Concatenate.

…

Evaluating a Model

rust
use rustyml::metrics::*;
use ndarray::array;

fn main() {
    // Arguments are always (y_true, y_pred)
    // ConfusionMatrix::new takes hard 0.0/1.0 labels (new_with_labels covers other pairs)
    let y_true = array![1.0, 0.0, 0.0, 1.0, 1.0];
    let y_pred = array![1.0, 0.0, 1.0, 1.0, 0.0];

    // The 2 arguments carry independent storage types, so an owned array and a view mix
    let cm = ConfusionMatrix::new(&y_true, &y_pred.view());
    println!("Accuracy: {:.3}", cm.accuracy());
    println!("F1 score: {:.3}", cm.f1_score());
}

Modules

See at docs.rs

Feature Flags

The crate uses feature flags for modular compilation:

Feature Description
machine_learning Classical ML algorithms (enables math)
neural_network Neural-network framework (enables math)
utils Data preprocessing and dataset splitting (enables math)
metrics Evaluation metrics (enables math)
math Numerical primitives (distances, matrix products, parallel reductions)
full All of the above modules
default full
show_progress Render training/iteration progress bars in the terminal

Project Status

RustyML is under active development. The API is stabilizing, but breaking changes can still appear in minor releases before 1.0.0.

Contributing

Contributions are welcome. To help build the Rust ML library, you can:

  1. Open issues for bugs or feature requests
  2. Submit pull requests for improvements
  3. Share feedback on the API design
  4. Improve the documentation and examples

Please also review the Code of Conduct.

Author

SomeB1oody ([email protected])

License

The MIT License covers this project. See the LICENSE file for details.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustaimachine-learningmachine-learning-algorithmsrust-crate

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言