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:
Metadata
Release files for mlscorer 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mlscorer-0.3-py3-none-any.whl | Python 3 | none | any | Details |
Release files / mlscorer-0.3-py3-none-any.whl
| Download URL | mlscorer-0.3-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f0d14b8b0ba61989d5b8181aa79935b3899c1c56b92f9182b110db68d73664b
|
|
BLAKE2b-256 checksum How to use checksums |
ca12f5259e5a1e9447996dc005ec5e5510723cfc115db31741773186c8dd8c02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|