Code Monkey home page Code Monkey logo

scikit-viz's Introduction

scikit-viz

scikit-viz aims to provide a collection of templates to make producing plots to evaluate models built using scikit-learn much simpler.

Installation

$ pip install scikit-viz

Current Features

  • plot_roc(y, y_pred, spacing=0.2, indifference=None)

    • y actual value (1 or 0)
    • y_pred probability of 1
    • spacing governs the spacing between threshold labels
    • indifference is a dictionary defined as follows:
      {
      
          'rate_positive': 0.95, # rate of 1 case
          
          'rate_negative': 0.05, # rate of 0 case
          
          'tp_util': 20, # utility of true positives
          
          'tn_util': -50, # utility of true negatives
          
          'fp_util': -300, # utility of false positives
          
          'fn_util': -50 # utility of false negatives
          
      }
      
      Provide this dictionary describing the economic utility and frequency of false positives and false negatives, and it will produce an indifference curve on the plot which provides a threshold above which the classifier is economically useful. For more information on this extremely interesting concept, see this blog post (http://blog.mldb.ai/blog/posts/2016/01/ml-meets-economics/)
  • plot_precision_recall(y, y_pred, spacing=0.2)

    • y actual value (1 or 0)
    • y_pred probability of 1
    • spacing governs the spacing between threshold labels

Usage

from sklearnviz import plot_roc
from sklearn import datasets

iris = datasets.load_iris()
X = iris.data
y = iris.target
y[y==2] = 0
from sklearn.linear_model import LogisticRegression
clf = LogisticRegression().fit(X,y)
y_pred = clf.predict_proba(X)[:,1]

# this is where the magic happens
plot_roc(y, y_pred, spacing=0.1)

plot_precision_recall(y, y_pred, spacing=0.15)

roc_curve precision_recall_curve

scikit-viz's People

Contributors

fernavid avatar

Stargazers

 avatar Victor Naidu avatar Albert Tavares de Almeida avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.