#machine-learning #ai #smartcore

automl

Automated machine learning for classification and regression

9 releases

0.2.7 May 29, 2023
0.2.6 Jun 13, 2022
0.2.5 Mar 6, 2022
0.2.4 Dec 20, 2021
0.1.0 Nov 12, 2021

#102 in Machine learning

Download history 1/week @ 2024-01-06 23/week @ 2024-01-13 77/week @ 2024-01-20 24/week @ 2024-01-27 5/week @ 2024-02-03 21/week @ 2024-02-10 83/week @ 2024-02-17 33/week @ 2024-02-24 65/week @ 2024-03-02 23/week @ 2024-03-09 151/week @ 2024-03-16 18/week @ 2024-03-23 44/week @ 2024-03-30 2/week @ 2024-04-06

218 downloads per month
Used in abd-clam

MIT/Apache

170KB
3.5K SLoC

Github CI Crates.io docs.rs

AutoML with SmartCore

AutoML is Automated Machine Learning, referring to processes and methods to make machine learning more accessible for a general audience. This crate builds on top of the smartcore machine learning framework, and provides some utilities to quickly train and compare models.

Install

To use the latest released version of AutoML, add this to your Cargo.toml:

automl = "0.2.7"

To use the bleeding edge instead, add this:

automl = { git = "https://github.com/cmccomb/rust-automl" }

Usage

Running the following:

let dataset = smartcore::dataset::breast_cancer::load_dataset();
let settings = automl::Settings::default_classification();
let mut classifier = automl::SupervisedModel::new(dataset, settings);
classifier.train();

will perform a comparison of classifier models using cross-validation. Printing the classifier object will yield:

┌────────────────────────────────┬─────────────────────┬───────────────────┬──────────────────┐
│ Model                          │ Time                │ Training Accuracy │ Testing Accuracy │
╞════════════════════════════════╪═════════════════════╪═══════════════════╪══════════════════╡
│ Random Forest Classifier       │ 835ms 393us 583ns   │ 1.00              │ 0.96             │
├────────────────────────────────┼─────────────────────┼───────────────────┼──────────────────┤
│ Logistic Regression Classifier │ 620ms 714us 583ns   │ 0.97              │ 0.95             │
├────────────────────────────────┼─────────────────────┼───────────────────┼──────────────────┤
│ Gaussian Naive Bayes           │ 6ms 529us           │ 0.94              │ 0.93             │
├────────────────────────────────┼─────────────────────┼───────────────────┼──────────────────┤
│ Categorical Naive Bayes        │ 2ms 922us 250ns     │ 0.96              │ 0.93             │
├────────────────────────────────┼─────────────────────┼───────────────────┼──────────────────┤
│ Decision Tree Classifier       │ 15ms 404us 750ns    │ 1.00              │ 0.93             │
├────────────────────────────────┼─────────────────────┼───────────────────┼──────────────────┤
│ KNN Classifier                 │ 28ms 874us 208ns    │ 0.96              │ 0.92             │
├────────────────────────────────┼─────────────────────┼───────────────────┼──────────────────┤
│ Support Vector Classifier      │ 4s 187ms 61us 708ns │ 0.57              │ 0.57             │
└────────────────────────────────┴─────────────────────┴───────────────────┴──────────────────┘

You can then perform inference using the best model with the predict method.

Features

This crate has several features that add some additional methods

Feature Description
nd Adds methods for predicting/reading data using ndarray.
csv Adds methods for predicting/reading data from a .csv using polars.

Capabilities

  • Feature Engineering
    • PCA
    • SVD
    • Interaction terms
    • Polynomial terms
  • Regression
    • Decision Tree Regression
    • KNN Regression
    • Random Forest Regression
    • Linear Regression
    • Ridge Regression
    • LASSO
    • Elastic Net
    • Support Vector Regression
  • Classification
    • Random Forest Classification
    • Decision Tree Classification
    • Support Vector Classification
    • Logistic Regression
    • KNN Classification
    • Gaussian Naive Bayes
  • Meta-learning
    • Blending
  • Save and load settings
  • Save and load models

Dependencies

~5.5–9.5MB
~193K SLoC