Skip to main content

Does the same thing as sklearn.metrics but 100x faster.

Project description

Fast Metrics

This project provides a set of faster alternatives to some of the methods in sklearn.metrics. If you use any of the classification metrics supported by this package, you will see a vast improvement in the runtime of your code, up to 100x depending on the function used and the size of the data set. Speedups were achieved by using Numba to vectorize the generation of confusion matrices.

Fast Metrics supports the following metrics:

  • Accuracy Score
  • Balanced Accuracy Score
  • F1 Score
  • Precision
  • Recall
  • Jaccard Score
  • ROC AUC

Installation

Run the following to install:

pip install fastmetrics

Usage

Use Fast Metrics the same way you would use sklearn.metrics. Feed the methods a NumPy array of true results and a NumPy array of predictions, and they will return their respective metric. For instance:

fastmetrics.fast_accuracy_score(y_true, y_pred)
fastmetrics.fast_balanced_accuracy_score(y_true, y_pred)
fastmetrics.fast_f1_score(y_true, y_pred)

Additional Notes:

  • Unlike sklearn, Fast Metrics methods do not have additional optional arguments beyond y_true and y_pred.
  • The first time you run a Fast Metrics function, it will be slower than its sklearn counterpart because the vectorized confusion matrix code needs time to compile.

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

fastmetrics-0.0.10.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

fastmetrics-0.0.10-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file fastmetrics-0.0.10.tar.gz.

File metadata

  • Download URL: fastmetrics-0.0.10.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fastmetrics-0.0.10.tar.gz
Algorithm Hash digest
SHA256 37dd324aca47aaa3502121f12aab602447e4ecd4be026e07d45b5bb20391f7b8
MD5 e05e0f1a3d6d16532c402cef886fb117
BLAKE2b-256 b8e66ba124a20067822245d5900e7a912a56355cfeef7773e2eafb10c20a9045

See more details on using hashes here.

File details

Details for the file fastmetrics-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: fastmetrics-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fastmetrics-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 2c87449e1060e6cd238fb017694f58994a5933334a98b6a2ce1211edb6d9b2d7
MD5 dad67b788a18ed3f2538f1cbad943de8
BLAKE2b-256 ef3b9a023527dec47306165b7a49214878259f7cc564eb3ac6f46bf833b760c5

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