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" 55 algorithms with 2 methods .fit and .predict
Classifiers "cla" 42 algorithms with 2 methods .fit and .predict
Clustering "clu" 12 clustering algorithms (.predict supported for 6)
Transformations "tra" 68 transform functions (e.g. MinMaxScaler, PCA, TSNE, etc.)

In total, the tool allows benchmarking 280 scikit-learn functions (55*2+42*2+12+6+68).

The exact counts may vary depending on your installed scikit-learn version (here 1.6.1), the data characteristics (#samples, #features, #output), and other software dependencies.


⏱ 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

  • min_prof_time: Minimum time in seconds to run the profiling of each function (reduces noise)
  • max_prof_time: Maximum time in seconds to run the profiling. If the delay is reached, a timeout interrupts the computation.
  • 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,
  min_prof_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.2.tar.gz (19.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.2-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scikit_learn_bench-0.1.2.tar.gz
  • Upload date:
  • Size: 19.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.2.tar.gz
Algorithm Hash digest
SHA256 f222b197bb5473ad8d898b357216695b11928761490587a48b5d951b16d706b6
MD5 bf7e886c8f075eb4c640ac4d8e32e097
BLAKE2b-256 bf92ba6900d8a7c2b441b86457ff95d3b5ed8d9bf9bf5647bbf5dead8b1e34a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_learn_bench-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0d8bfa3b197e16cbc2752b3c60137e2675c147d35f7619be90e8077568f30d2f
MD5 b913d367253dcb21d5a122732daee47e
BLAKE2b-256 020aceacb7f7558c6346771c9b0556c90980f7480456daa4715822d621ba1f73

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