Created
May 19, 2016 17:49
-
-
Save matmoody/1f2e27e99ad8d78023a794e5db59d97d to your computer and use it in GitHub Desktop.
Visualization prior to running kmeans
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
%matplotlib inline | |
iris = pd.read_csv("https://raw.githubusercontent.com/Thinkful-Ed/curric-data-001-data-sets/master/iris/iris.data.csv", names = ['Sepal_l', 'Sepal_w', 'petal_l', 'petal_w', 'class']) | |
# Make class categorical variable | |
iris['class'] = pd.Categorical(iris['class']).codes | |
# Plot Sepal_length and Sepal_width | |
plt.scatter(iris['Sepal_l'], iris['Sepal_w'], c=iris['class']) | |
plt.xlabel('Sepal length') | |
plt.ylabel('Sepal Width') | |
plt.show() | |
# Plot petal_length and petal_width | |
plt.scatter(iris['petal_l'], iris['petal_w'], c=iris['class']) | |
plt.xlabel('Petal length') | |
plt.ylabel('Petal Width') | |
plt.show() | |
# Plot sepal_length and petal_width | |
plt.scatter(iris['Sepal_l'], iris['petal_w'], c=iris['class']) | |
plt.xlabel('Sepal Length') | |
plt.ylabel('Petal Width') | |
plt.show() | |
# Plot petal_length and sepal_width | |
plt.scatter(iris['petal_l'], iris['Sepal_w'], c=iris['class']) | |
plt.xlabel('Petal Length') | |
plt.ylabel('Sepal Width') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment