ML-learning-path

Self learning guide for machine learning

View the Project on GitHub elephantscale/ML-learning-path

Scikit-Learn Library

(back to Index)

Scikit-Learn is the go-to library for machine learning in Python.

Scikit Intro

Scikit Algorithms Overview and Cheatsheet

Setting up Scikit

Explore Built in Datasets

Creating synthetic data

Creating train/test splits

More Reading

Data Leakage


Checklist

You should know the following


Exercises

A - Basics

A1 - Make sure you have scikit installed

import sklearn
sklearn.__version__
# you should see version output

B - Builtin Datasets

B1 - Print out all datasets that are included in scikit

B2 - Regression dataset: Load boston dataset

B3 - Classification dataset: Load IRIS dataset

C - Generate Data

C1 - make classification dataset

C2 - Use make_regression to make a regression dataset

D - train/test split

D1 - Simple train/test split

Create data like this

import pandas as pd
from sklearn.model_selection import train_test_split

tip_data = pd.DataFrame({'bill' : [50.00, 30.00, 60.00, 40.00, 65.00, 20.00, 10.00, 15.00, 25.00, 35.00],
                        'tip' : [12.00, 7.00, 13.00, 8.00, 15.00, 5.00, 2.00, 2.00, 3.00, 4.00]})

x = tip_data[['bill']]
y = tip_data[['tip']]

# Use train_test_split function (20% test split)
x_train,x_test,y_train, y_test = train_test_split (x,y,test_size=0.2)

D2 - test/train split on housing data

Read the house-sales-simplified.csv.

import pandas as pd

house_sales = pd.read_csv(...)

X = extract all columns except `SalePrice`
y = extract `SalePrice` column

Now split the X,y data into training and testing.

Print out the length of train and test datasets.

Since the data is too large to visually inspect, how can we programmatically ensure there are no common elements between train and test

More exercises


Index