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" 52 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 261 scikit-learn functions (522+412+12+6+57).

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

Some algorithms are callable in some specific conditions. 29 regressors manage multiple targets, 23 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.1.tar.gz (18.2 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.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scikit_learn_bench-0.1.1.tar.gz
  • Upload date:
  • Size: 18.2 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.1.tar.gz
Algorithm Hash digest
SHA256 b1bb0fce6b7a22ed402756006ca9acb0615deec9717755f17407938074ed9076
MD5 8162d4efedcb597bde0ea17cbc88c040
BLAKE2b-256 9273c4f2e16482b549ca4799b28eac2b431145472c781d1cebd6bcc25f07ef88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_learn_bench-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 21899df4d9b5e80a148aef7f947cd78efe14806711168fdb54e9ec3803901dc6
MD5 9a85256e8481d08a76af8782fc75804b
BLAKE2b-256 53119c95f950ba8ec44930f8e4ee611cd68e414b67c32f2127f76f0f27001ae8

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