Skip to main content

ML Benchmark used to compare platforms

Project description

scikit-learn-bench

Benchmark 100+ scikit-learn Machine Learning algorithms at once — in just a few seconds.

This tool offers an easy way to evaluate models across multiple ML categories and profiling strategies.


📦 Installation

pip3 install scikit_learn_bench

🚀 Features

📊 Data Generation

Easily control the characteristics of synthetic datasets:

  • num_samples: Number of samples (rows)
  • num_features: Number of input features (columns)
  • num_output: Target shape — used for regression, classification, clusters, or transformed outputs

🧠 ML Algorithm Types

Type Label Description
Regressors "reg" 51 algorithms with 2 functions .fit and .predict
Classifiers "cla" 41 algorithms with 2 functions .fit and .predict
Clustering "clu" 12 clustering algorithms (predict supported for 6)
Transformations "tra" 57 transform functions (e.g. MinMaxScaler, PCA, TSNE, etc.)

In total, the tool allows benchmarking 259 scikit-learn functions.

The exact counts may vary depending on your installed scikit-learn version (here 1.3.0) and other dependencies.

Some algorithms are callable in some specific conditions. 29 regressors manage multiple targets, 22 regressors manage 1 target only.


⏱ Profiling Strategies

Choose one of three profiler types:

  • "time":
    Measures training and inference throughput (samples/sec).
    Output: (train_throughput, infer_throughput)

  • "timememory":
    Adds peak memory (kB) with tracemalloc.
    Output: (train_throughput, infer_throughput, train_peak_memory, infer_peak_memory)

  • "timeline":
    Fine-grained cProfile analysis saved as .prof files for each algorithm.
    Output: .prof file per model


⚙️ Other Parameters

  • fix_comp_time: Minimum time in seconds to run each profile (reduces noise)
  • table_print: Display formatted results in console
  • table_print_sort_crit: Sort results (e.g., by training speed)
  • line_profiler_path: Path to store .prof files for "timeline" profiler

🧪 Example Usage

CLI

After installing scikit_learn_bench, you can invoke it directly from the command line:

pierrick@laptop:~$ pip3 install scikit_learn_bench
pierrick@laptop:~$ scikit_learn_bench

For detailed usage and options, run:

scikit_learn_bench --help

Programming interface (advanced)

from scikit_learn_bench.core import bench
scores=bench(
    num_samples=10,
    num_features=2,
    num_output=2,
    fix_comp_time=0.1,
    ml_type="cla",
    profiler_type="timememory",
    table_print=True
)

This function returns a dictionary with performance metrics for each algorithm, such as:

{
    'AdaBoostClassifier': (4454.128, 48093.051, 94.06, 19.29),
    'BaggingClassifier': (282.16, 6696.015, 96.019, 162.843),
    ...
}

The output includes:

  • Train/s: Training speed (samples per second)
  • Train Mem: Memory usage during training (MB)
  • Infer/s: Inference speed (samples per second)
  • Infer Mem: Memory usage during inference (MB)

Advanced performance analysis

dAditionally, the usage_example/ directory contains scripts for advanced analyses, including:

  • 2D cloud points comparing throughput and memory consumption across all algorithms
  • Scalability studies examining how performance varies with data size (samples, features, output size)
  • Analysis of algorithm performance as the number of CPU cores increases, helping identify which algorithms benefit most from parallel processing

📚 Citing scikit-learn-bench

Work in progress: BibTeX / reference for citing this repo.

🙏 Acknowledgments

ULHPC Platform for computing support and motivating this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scikit_learn_bench-0.1.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scikit_learn_bench-0.1.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file scikit_learn_bench-0.1.0.tar.gz.

File metadata

  • Download URL: scikit_learn_bench-0.1.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for scikit_learn_bench-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ac5a687f1f3d52f9c537103c82ce317a488602212b117977afaa9ea78e476652
MD5 0025802dd9d894f08fa13f77c0659cb1
BLAKE2b-256 eafb2bfb8a59b8528f6860e09ec07fa9f1750de0912ee6a36c86516adaee2c20

See more details on using hashes here.

File details

Details for the file scikit_learn_bench-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for scikit_learn_bench-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ec7b3c2b50bdcc0c9e69ccfb079d7096a7bb705b07aaa7f70860195364910dd
MD5 f4a93841a7216c363201650f9b513cc3
BLAKE2b-256 9b2a4a8fe53c0a378d535bd7e9e8e6bd7cebe852ad7f0f808f798c09014abdfe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page