Skip to main content

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:

drawing

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:

drawing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mlscorer-0.3-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page