Simple python package to sanitize in a standard way ML-related labels.
Project description
Simple python package to sanitize in a standard way ML-related labels.
How do I install this package?
As usual, just download it using pip:
pip install sanitize_ml_labels
Tests Coverage
Since some software handling coverages sometime get slightly different results, here’s two of them:
Why do I need this?
So you have some kind of plot and you have some ML-related labels. Since I always rename and sanitize them the same way, I have prepared this package to always sanitize them in a standard fashion.
Usage examples
Here you have a couple of common examples: you have a set of metrics to normalize or a set of model names to normalize.
from sanitize_ml_labels import sanitize_ml_labels
# Example for metrics
labels = [
"acc",
"loss",
"auroc",
"lr"
]
sanitize_ml_labels(labels)
# ["Accuracy", "Loss", "AUROC", "Learning rate"]
# Example for models
labels = [
"vanilla mlp",
"vanilla cnn",
"vanilla ffnn",
"vanilla perceptron"
]
sanitize_ml_labels(labels)
# ["MLP", "CNN", "FFNN", "Perceptron"]
Extra utilities
Since I always use metric sanitization alongside axis normalization, it is useful to know which axis should be maxed between zero and one to avoid any visualization bias to the metrics.
For this reason I have created the method is_normalized_metric
, which after having normalized the given metric
validates it against known normalized metrics (metrics between 0 and 1, is there another name? I could not figure out a better one).
from sanitize_ml_labels import is_normalized_metric
is_normalized_metric("MSE") # False
is_normalized_metric("acc") # True
is_normalized_metric("accuracy") # True
is_normalized_metric("AUROC") # True
is_normalized_metric("auprc") # True
New features and issues
As always, for new features and issues you can either open a new issue and pull request. A pull request will always be the quicker way, but I’ll look into the issues when I get the time.
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
Hashes for sanitize_ml_labels-1.0.27.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fff45f928671a51c797e1c006da054d5c1d3b2d15fd0f6f131eb8307d46adb96 |
|
MD5 | aab2917a0a34cbc67c4817afeaa75edc |
|
BLAKE2b-256 | 9a76041a8389d6b052d7019db98390b0273ccc6750d333b1e63c1a823468f28f |