No project description provided
Project description
ML Scorer
ML Scorer is the solution to your classification scores of ML algorithms.
Installation
pip install mlscorer
Preperation
Make a class mapping dictionary(map_class) using Method1 or Method2
Method 1
Make all the data categorical using following code snippet
map_class = dict(zip(df.classes.astype("category").cat.codes, df.classes))
print(map_class)
output: {1: 'positive', 0: 'negative'}
here, df is the Dataframe and classes is a column which may have class values like
- positive
- negative
[N.B. Don't change "category", it's a datatype]
or
Method 2
Make the Dictionary manually according to your classes
map_class = {
1: 'positive',
0: 'negative'
}
Usage
from sklearn.linear_model import LogisticRegression
import mlscorer as ms
classifier = LogisticRegression()
classifier.fit(X_train, y_train)
y_pred = classifier.predict(X_test)
ms.get_score_table(y_test, y_pred, map_class)
Output:
Parameters
y_test : target values of test set
y_pred : predicted target values
map_class : dict : your categoricl class mapping
metrics : list : use one or more evaluation metric from f1, precision, recall or accuracy
eg:
ms.get_score_table(y_test, y_pred, map_class, metrics=['precision', 'recall'])
Output:
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 Distributions
Built Distribution
File details
Details for the file mlscorer-0.3-py3-none-any.whl
.
File metadata
- Download URL: mlscorer-0.3-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.21.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f0d14b8b0ba61989d5b8181aa79935b3899c1c56b92f9182b110db68d73664b |
|
MD5 | 0283862ee3cc341f666deb6d094c2681 |
|
BLAKE2b-256 | ca12f5259e5a1e9447996dc005ec5e5510723cfc115db31741773186c8dd8c02 |