Subscribe to our Newsletter

Dataviz with Python

This article was written by Reiichiro Nakano.

There are a number of visualizations that frequently pop up in machine learning. Scikit-plot is a humble attempt to provide aesthetically-challenged programmers (such as myself) the opportunity to generate quick and beautiful graphs and plots with as little boilerplate as possible.

Here's a quick example to generate the precision-recall curves of a Keras classifier on a sample dataset:

# Import what's needed for the Functions API
import matplotlib.pyplot as plt
import scikitplot.plotters as skplt

# This is a Keras classifier. We'll generate probabilities on the test set.
keras_clf.fit(X_train, y_train, batch_size=64, nb_epoch=10, verbose=2)
probas = keras_clf.predict_proba(X_test, batch_size=64)

# Now plot.
skplt.plot_precision_recall_curve(y_test, probas)
plt.show()

Installation is of the sciplot library is simple! First, make sure you have the dependencies Scikit-Learn and Matplotlib installed.

Then just run:

pip install scikit-plot

Or if you want, clone this repo and run

python setup.py install

at the root folder.

Originally posted here.

 

 

E-mail me when people leave their comments –

You need to be a member of DataViz to add comments!

Join DataViz

Webinar Series

Follow Us

@DataScienceCtrl | RSS Feeds

Careers

Advanced Analytics Manager

Central California Alliance for Health - Advanced Analytics ManagerScotts Valley, CAABOUT USWe are a group of over 500 dedicated employees, committed to our mission of providing accessible...

Senior Data Scientist

Cogitativo - Senior Data ScientistSenior Data Scientists on our team partner with product managers, SMEs and our clients  to form a cross-functional team drivin...

Software Engineer, Data Flow - Facebook

Facebook - Facebook's mission is to give people the power to build community and bring the world closer together. Through our family of apps and services...