Skip to main content

Python package classeval

Project description

classeval

Python PyPI Version License Downloads Downloads Sphinx

The library classeval is developed to evaluate the models performance of any kind of two-class or multi-class model. classeval computes many scoring measures in case of a two-class clasification model. Some measures are utilized from sklearn, among them AUC, MCC, Cohen kappa score, matthews correlation coefficient, whereas others are custom. This library can help to consistenly compare the output of various models. In addition, it can also give insights in tuning the models performance as the the threshold being used can be adjusted and evaluated. The output of classeval can subsequently plotted in terms of ROC curves, confusion matrices, class distributions, and probability plots. Such plots can help in better understanding of the results.

Docs

Navigate to API documentations for more detailed information.

Contents

Installation

  • Install classeval from PyPI (recommended). classeval is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows.
  • It is distributed under the MIT license.

Quick Start

pip install classeval
  • Alternatively, install classeval from the GitHub source:
git clone https://github.com/erdogant/classeval.git
cd classeval
python setup.py install

Import classeval package

import classeval as clf

Example two-class model:

from sklearn.model_selection import train_test_split
from sklearn.ensemble.gradient_boosting import GradientBoostingClassifier
gb = GradientBoostingClassifier()

X, y = clf.load_example('breast')
X_train, X_test, y_train, y_true = train_test_split(X, y, test_size=0.2)
model = gb.fit(X_train, y_train)
y_proba = model.predict_proba(X_test)[:,1]
y_pred = model.predict(X_test)

# Evaluate
out = clf.eval(y_true, y_proba, pos_label='malignant')
ax = clf.plot(out, figsize=(20,15), fontsize=14)

Example multi-class model:

X,y = clf.load_example('iris')
X_train, X_test, y_train, y_true = train_test_split(X, y, test_size=0.5)

model = gb.fit(X_train, y_train)
y_pred = model.predict(X_test)
y_proba = model.predict_proba(X_test)
y_score = model.decision_function(X_test)

# All
out = clf.eval(y_true, y_proba, y_score, y_pred)
ax = clf.plot(out)

Citation

Please cite classeval in your publications if this is useful for your research. Here is an example BibTeX entry:

@misc{erdogant2020classeval,
  title={classeval},
  author={Erdogan Taskesen},
  year={2019},
  howpublished={\url{https://github.com/erdogant/classeval}},
}

Maintainers

Contribute

  • Contributions are welcome.

Licence

See LICENSE for details.

Project details


Download files

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

Source Distribution

classeval-0.1.11.tar.gz (15.4 kB view hashes)

Uploaded Source

Built Distribution

classeval-0.1.11-py3-none-any.whl (16.9 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