<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Getting started in scikit-learn with the famous iris dataset
From the video series
Step1:  Machine learning on the iris dataset
Framed as a supervised learning problem
Step2:  Machine learning terminology
Each row is an observation (also known as
Step3:  Each value we are predicting is the response (also known as
Step4:  Resources
scikit-learn documentation
<ASSISTANT_TASK:>
Python Code:
from IPython.display import HTML
HTML('<iframe src=http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data width=300 height=200></iframe>')
Explanation: Getting started in scikit-learn with the famous iris dataset
From the video series: Introduction to machine learning with scikit-learn
Agenda
What is the famous iris dataset, and how does it relate to machine learning?
How do we load the iris dataset into scikit-learn?
How do we describe a dataset using machine learning terminology?
What are scikit-learn's four key requirements for working with data?
Introducing the iris dataset
50 samples of 3 different species of iris (150 samples total)
Measurements: sepal length, sepal width, petal length, petal width
End of explanation
# import load_iris function from datasets module
from sklearn.datasets import load_iris
# save "bunch" object containing iris dataset and its attributes
iris = load_iris()
type(iris)
# print the iris data
print iris.data
Explanation: Machine learning on the iris dataset
Framed as a supervised learning problem: Predict the species of an iris using the measurements
Famous dataset for machine learning because prediction is easy
Learn more about the iris dataset: UCI Machine Learning Repository
Loading the iris dataset into scikit-learn
End of explanation
# print the names of the four features
print iris.feature_names
# print integers representing the species of each observation
print iris.target
# print the encoding scheme for species: 0 = setosa, 1 = versicolor, 2 = virginica
print iris.target_names
Explanation: Machine learning terminology
Each row is an observation (also known as: sample, example, instance, record)
Each column is a feature (also known as: predictor, attribute, independent variable, input, regressor, covariate)
End of explanation
# check the types of the features and response
print type(iris.data)
print type(iris.target)
# check the shape of the features (first dimension = number of observations, second dimensions = number of features)
print iris.data.shape
# check the shape of the response (single dimension matching the number of observations)
print iris.target.shape
# store feature matrix in "X"
X = iris.data
# store response vector in "y"
y = iris.target
Explanation: Each value we are predicting is the response (also known as: target, outcome, label, dependent variable)
Classification is supervised learning in which the response is categorical
Regression is supervised learning in which the response is ordered and continuous
Requirements for working with data in scikit-learn
Features and response are separate objects
Features and response should be numeric
Features and response should be NumPy arrays
Features and response should have specific shapes
End of explanation
from IPython.core.display import HTML
def css_styling():
    styles = open("styles/custom.css", "r").read()
    return HTML(styles)
css_styling()
Explanation: Resources
scikit-learn documentation: Dataset loading utilities
Jake VanderPlas: Fast Numerical Computing with NumPy (slides, video)
Scott Shell: An Introduction to NumPy (PDF)
Comments or Questions?
Email: &#107;&#101;&#118;&#105;&#110;&#64;&#100;&#97;&#116;&#97;&#115;&#99;&#104;&#111;&#111;&#108;&#46;&#105;&#111;
Website: http://dataschool.io
Twitter: @justmarkham
End of explanation
<END_TASK>