Skip to main content

Machine Learning Performance Testing Framework

Project description

Build Status MIT license pypi badge

tempeh

tempeh is a framework to

TEst

Machine learning

PErformance

exHaustively

which includes tracking memory usage and run time. This is particularly useful as a pluggable tool for your repository's performance tests. Typically, people want to run them periodically over various datasets and/or with a number of models to catch regressions with respect to run time or memory consumption. This should be as easy as

import pytest
from time import time
from tempeh.configurations import datasets, models

@pytest.mark.parametrize('Dataset', datasets.values())
@pytest.mark.parametrize('Model', models.values())
def test_fit_predict_regression(Dataset, Model):
    dataset = Dataset()
    model = Model()
    max_execution_time = get_max_execution_time(dataset, model)
    if model.compatible_with_dataset(dataset):
        start_time = time()
        model.fit(dataset.X_train, dataset.y_train)
        model.predict(dataset.X_test)
        duration = time() - start_time

        assert duration < max_execution_time

Installation

tempeh depends on various packages to provide models, including tensorflow, torch, xgboost, lightgbm. To install a release version of tempeh just run

pip install tempeh
Common issues
  • If you're using a 32-bit Python version you might need to switch to a 64-bit Python version first to successfully install tensorflow.
  • If the installation of torch fails try using the recommendation from the pytorch website for stable versions without CUDA for your python version on your operating system.

Structure

Datasets

Datasets (located in the datasets/ directory) encapsulate different datasets used for testing.

To add a new one

  • Create a python file in the datasets/ directory with naming convention [name]_datasets.py
  • Subclass BasePerformanceDatasetWrapper. The naming convention is [dataset_name]PerformanceDatasetWrapper
  • In __init__ load the dataset and call super().__init__(data, targets, size)
  • Add the class to __init__.py
  • Make sure the class contains class variables task, data_type, size
  • Add an entry to the datasets dictionary in configurations.py.

Models

Models (models/ directory) wrap different machine learning models.

To add a new one

  • Create a python file in the models/ directory with naming convention [name]_model.py
  • Subclass BaseModelWrapper and name the class [name]ModelWrapper
  • In __init__ train the model; we expect format __init__(self, ...)
  • Models must contain tasks and algorithm
  • Add an entry to the models dictionary in configurations.py.

Maintainers

In alphabetical order:

Contributing

To contribute please check our Contributing Guide.

Issues

Regular (non-Security) Issues

Please submit a report through Github issues. A maintainer will respond within a reasonable period of time to handle the issue as follows:

  • bug: triage as bug and provide estimated timeline based on severity
  • feature request: triage as feature request and provide estimated timeline
  • question or discussion: triage as question and respond or notify/identify a suitable expert to respond

Maintainers are supposed to link duplicate issues when possible.

Reporting Security Issues

Please take a look at our guidelines for reporting security issues.

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

tempeh-0.1.4.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

tempeh-0.1.4-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

Details for the file tempeh-0.1.4.tar.gz.

File metadata

  • Download URL: tempeh-0.1.4.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for tempeh-0.1.4.tar.gz
Algorithm Hash digest
SHA256 cdb30bde219a5320efb491eb45b1c2530fc1b44c014d1570050cfb7bfe77460a
MD5 47f04c8f2791916e8e8e1327290eb239
BLAKE2b-256 0c6fa7b35b0ece5f91dfeba7be0185bcaa20070d89ad0e83e65220b36f3a5c76

See more details on using hashes here.

Provenance

File details

Details for the file tempeh-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: tempeh-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for tempeh-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 332c11b9cf4a941f6bec1331096aefe1f7a323e955c5b5ffbef8182919e8d166
MD5 b8308c8a2c25343ee1caf8ab2e0aa814
BLAKE2b-256 73fcc3b20aa4b85ae7cc948ed5fdc08f52ce7c555aa423bda858a4f0caac79a0

See more details on using hashes here.

Provenance

Supported by

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