Module containing various utility functions for classification tasks
Project description
classification_lib
A custom module that grants access to libraries with utility functions for performing classification tasks such as:
-
Plotting precision-recall curves for multiple classifiers for easier comparisons.
-
Plotting ROC curves for multiple classifiers for easier comparisons.
Installation
pip install classification_lib
Get Started
How to plot different pr-curve(s) for classifier(s) using the plot_pr_curve of this library:
from classification_lib import Plots
import numpy as np
# Instantiating the precisions and recalls for two different classifiers
classifier1_precisions = np.sort(0.791 + 0.168 * np.random.randn(794))
classifier2_precisions = np.sort(0.5 + 0.142 * np.random.randn(794))
classifier1_recalls = sorted(0.70 + 0.299 * np.random.randn(794), reverse=True)
classifier2_recalls = sorted(0.3 + 0.5 * np.random.randn(794), reverse=True)
classifier1_name = "Classifier 1"
classifier2_name = "Classifier 2"
classifiers = [(classifier1_name, classifier1_precisions, classifier1_recalls),
(classifier2_name, classifier2_precisions, classifier2_recalls)]
# Instantiate a Plot object
plot = Plots(classifiers)
# Call the pr_curve_plot method
result = plot.plot_pr_curve()
How to plot different pr-curve(s) for classifier(s) using the plot_roc_curve of this library:
import numpy as np
from classification_lib import Plots
classifier1_false_positive_rate = sorted(0.29 + 0.248 * np.random.randn(219))
classifier2_false_positive_rate = sorted(0.7 + 0.4 * np.random.randn(219))
classifier1_true_positive_rate= sorted(0.788 + 0.2 * np.random.randn(219))
classifier2_true_positive_rate = sorted(0.6 + 0.3 * np.random.randn(219))
classifier1_name = "Classifier 1"
classifier2_name = "Classifier 2"
classifiers = [(classifier1_name, classifier1_false_positive_rate, classifier1_true_positive_rate),
(classifier2_name, classifier2_false_positive_rate, classifier2_true_positive_rate)]
# Instantiate a Plot object
plot = Plots(classifiers)
# Call the pr_curve_plot method
result = plot.plot_roc_curve()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file classification_lib-1.0.0.tar.gz
.
File metadata
- Download URL: classification_lib-1.0.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | efcac7925a7403ba5d97f94c3b86ba9523429dccceefa216d6adc81a5fe8091a |
|
MD5 | c68ae324b61736a31264d247a302ab59 |
|
BLAKE2b-256 | 340d6cd12c147edd1826aa65a92e71f68cde4aec11c69f6e5855ac47c6728f9b |
File details
Details for the file classification_lib-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: classification_lib-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89789faae22d91dd3a47ff7baa454a4154fa4cf2a253aec347a5908c93df247f |
|
MD5 | bb51b055fa282336d1d1e2e93fc2a646 |
|
BLAKE2b-256 | 8c3dab91b92637ab1897de95a8685bb9312b56060e8cfc1a4e95959176bfa462 |