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: Playing with Iris Dataset
What is 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 dataset
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 he 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 (aka: sample, example, instance, record)
Each column is a feature (aka: predictor, attribute, independent variable, input, regressor, covariate)
End of explanation
"""


print type(iris.data)
print type(iris.target)

# check the shape of the features (first dimension= # of observations, second dimension = # of features)
print iris.data.shape
print iris.target.shape

# store the feature matrix in "X"
X = iris.data

# store the response vector in "y"
y = iris.target

"""
Explanation: Each value we are predicting is the response (aka: 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 responses are separate objects
Features and response should be numeric 
Features and response should by NumPy arrays
Feature 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 Intro to NumPy
End of explanation
"""


