In [2]:
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>')
Out[2]:
In [5]:
# import load_iris function from datasets module
from sklearn.datasets import load_iris
In [6]:
# save "bunch" object containing iris dataset and its attributes
iris = load_iris()
type(iris)
Out[6]:
In [7]:
# print the iris dataset
print iris.data
In [9]:
# print the names of the four features
print iris.feature_names
In [10]:
# print integers representing the species of each observation
print iris.target
In [11]:
# print the encoding scheme for species 0=setosa, 1=versicolor, 2=virginica
print iris.target_names
In [12]:
print type(iris.data)
print type(iris.target)
In [14]:
# check the shape of the features (first dimension= # of observations, second dimension = # of features)
print iris.data.shape
print iris.target.shape
In [16]:
# store the feature matrix in "X"
X = iris.data
# store the response vector in "y"
y = iris.target
In [17]:
from IPython.core.display import HTML
def css_styling():
styles = open("styles/custom.css","r").read()
return HTML(styles)
css_styling()
Out[17]: