Show Menu
Cheatography

Python Scikit-Learn Library Cheat Sheet (DRAFT) by

Scikit-Learn is one of the most effective python libraries for machine lerning and statistical modelling. This is built on Numpy, Pandas and Matplotlib.

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Machine Learning

Supervised Learning
Unsupe­rvised learning
The model maps input to an output based on the previous input-­output pairs
No training is given to the model and it has to discover the features of input by self training mechanism.
Scikit learn can be used in Classi­fic­ation, Regres­sion, Cluste­ring, Dimens­ion­ality reduct­ion­,Model Selection and prepro­cessing by supervised and unsupe­rvised training models.
 

Loading a dataset

>>> import numpy as np >>> X = np.ran­dom.ra­ndo­m((­10,5)) >>> y = np.arr­ay(­['M­','­M',­'F'­,'F­','­M',­'F'­,'M­','­M',­'F'­,'F­','F']) >>> X[X < 0.7] = 0

Processing the data

Standa­rdi­zation
Normal­ization
Binari­zation
Encoding Catego­rical Features
from sklear­n.p­rep­roc­essing import Standa­rdS­caler