All Projects → StKyr → multiscorer

StKyr / multiscorer

Licence: GPL-3.0 license
A module for allowing the use of multiple metric functions in scikit's cross_val_score

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to multiscorer

Python Machine Learning Book
The "Python Machine Learning (1st edition)" book code repository and info resource
Stars: ✭ 11,428 (+54319.05%)
Mutual labels:  data-mining, scikit-learn
Model Describer
model-describer : Making machine learning interpretable to humans
Stars: ✭ 22 (+4.76%)
Mutual labels:  data-mining, scikit-learn
PracticalMachineLearning
A collection of ML related stuff including notebooks, codes and a curated list of various useful resources such as books and softwares. Almost everything mentioned here is free (as speech not free food) or open-source.
Stars: ✭ 60 (+185.71%)
Mutual labels:  data-mining, scikit-learn
imbalanced-ensemble
Class-imbalanced / Long-tailed ensemble learning in Python. Modular, flexible, and extensible. | 模块化、灵活、易扩展的类别不平衡/长尾机器学习库
Stars: ✭ 199 (+847.62%)
Mutual labels:  data-mining, scikit-learn
Algorithmic-Trading
Algorithmic trading using machine learning.
Stars: ✭ 102 (+385.71%)
Mutual labels:  data-mining, scikit-learn
Amazing Feature Engineering
Feature engineering is the process of using domain knowledge to extract features from raw data via data mining techniques. These features can be used to improve the performance of machine learning algorithms. Feature engineering can be considered as applied machine learning itself.
Stars: ✭ 218 (+938.1%)
Mutual labels:  data-mining, scikit-learn
Sktime
A unified framework for machine learning with time series
Stars: ✭ 4,741 (+22476.19%)
Mutual labels:  data-mining, scikit-learn
Orange3
🍊 📊 💡 Orange: Interactive data analysis
Stars: ✭ 3,152 (+14909.52%)
Mutual labels:  data-mining, scikit-learn
kenchi
A scikit-learn compatible library for anomaly detection
Stars: ✭ 36 (+71.43%)
Mutual labels:  data-mining, scikit-learn
TextClassification
基于scikit-learn实现对新浪新闻的文本分类,数据集为100w篇文档,总计10类,测试集与训练集1:1划分。分类算法采用SVM和Bayes,其中Bayes作为baseline。
Stars: ✭ 86 (+309.52%)
Mutual labels:  data-mining, scikit-learn
AILA-Artificial-Intelligence-for-Legal-Assistance
Python implementations of the various methods used in FIRE 2019 conference.
Stars: ✭ 39 (+85.71%)
Mutual labels:  data-mining
sklearn-pmml-model
A library to parse and convert PMML models into Scikit-learn estimators.
Stars: ✭ 71 (+238.1%)
Mutual labels:  scikit-learn
kaggledatasets
Collection of Kaggle Datasets ready to use for Everyone (Looking for contributors)
Stars: ✭ 44 (+109.52%)
Mutual labels:  scikit-learn
rumor-fake-news-papers
🚨 Rumor, Fake News, Misinformation Papers
Stars: ✭ 35 (+66.67%)
Mutual labels:  data-mining
hub-toolbox-python3
Hubness analysis and removal functions
Stars: ✭ 17 (-19.05%)
Mutual labels:  data-mining
scikit-learn-mooc
Machine learning in Python with scikit-learn MOOC
Stars: ✭ 783 (+3628.57%)
Mutual labels:  scikit-learn
2018-Tencent-Lookalike
2018-腾讯广告算法大赛-相似人群拓展(初赛):10th/1563 (Top 0.64%)
Stars: ✭ 46 (+119.05%)
Mutual labels:  data-mining
bsu
🎓Repository for university labs on FAMCS, BSU
Stars: ✭ 91 (+333.33%)
Mutual labels:  data-mining
Heart-Diagnosis-Engine
2019년 민족사관고등학교 졸업 프로젝트
Stars: ✭ 12 (-42.86%)
Mutual labels:  scikit-learn
Cubist
A Python package for fitting Quinlan's Cubist regression model
Stars: ✭ 22 (+4.76%)
Mutual labels:  scikit-learn

multiscorer

A module for allowing the use of multiple metric functions in scikit's cross_val_score.

As it has been discussed, Python's SciKit, while it contains a great functionality for computing evaluation metrics of estimators (using cross_val_score), it seems to fail when it comes to computing multiple metrics for the same classifier without trainning it again.

The problem arises because of the scoring parameter of the function which accepts only a single metric name or a single callable.

Module multiscorer of this repo, is a workaround for using any number of metrics in cross_val_score.

Installation

To "install" the module simply download the source code and place it in your project's directory.
(Alternativelly, download and add to your project just multiscorer.py file).

Usage (Quickstart example)

From a Python script, you can write:

from multiscorer import MultiScorer

from sklearn.metrics import accuracy_score, precision_score          # Scikit's libraries for demonstration
from sklearn.model_selection import cross_val_score
from numpy import average

scorer = MultiScorer({                                               # Create a MultiScorer instance
  'accuracy': (accuracy_score, {}),
  'precision': (precision_score, {'average': 'macro'})               # Param 'average' will be passed to precision_score as kwarg 
})

...

cross_val_score(clf, X, target, scoring=scorer, cv=10)               # Use the function with our socrer. Ignore its result 

results = scorer.get_results()                                       # Get a dict of lists containing the scores for each metric

for metric in results.keys():                                        # Iterate and use the results
  print("%s: %.3f" % (metric, average(results[metric])))

Notes

Development and Contributing

This module was something I had the need for while working with Scikit's libraries and I just thought it might help somebody.
For questions, bugs, suggestions etc, feel free to contact me or submit a Pull Request.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].