Working with the ‘Iris’ data set for Machine Learning

Taking the iris data set:

from sklearn.datasets import load_iris
iris_dataset = load_iris()

then loading it into a pandas DataFrame and displaying the data in the training set using pd.plotting.scatter_matrix

# create dataframe from data in X_train
# label the columns using the strings in iris_dataset.feature_names
iris_dataframe = pd.DataFrame(X_train, columns=iris_dataset.feature_names)
# create a scatter matrix from the dataframe, color by y_train
pd.plotting.scatter_matrix(iris_dataframe, c=y_train, figsize=(9, 9),
marker='o', hist_kwds={'bins': 20}, s=60,
alpha=.8, cmap=mglearn.cm3)

Leave a Reply

Your email address will not be published. Required fields are marked *