Metadata-Version: 2.1
Name: mlscorer
Version: 0.2
Summary: UNKNOWN
Home-page: UNKNOWN
Author: Avishek Das
Author-email: avishek.das.ayan@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: prettytable
Requires-Dist: scikit-learn

# 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

```py
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
```py
map_class = {
    1: 'positive',
    0: 'negative'
}
```
# Usage
```py
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:*

<img src="https://i.ibb.co/L0SQgKW/Capture.png" alt="drawing" width="700"/>

### 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:
```py
ms.get_score_table(y_test, y_pred, map_class, metrics=['precision', 'recall'])
```
*Output:*

<img src="https://i.ibb.co/hdsHbB3/metric.png" alt="drawing" width="700"/>

