From the course: Data Science Foundations: Data Mining in Python

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: K-means

Challenge: K-means - Python Tutorial

From the course: Data Science Foundations: Data Mining in Python

Start my 1-month free trial

Challenge: K-means

(upbeat music) - [Instructor] But now it's time for you to get a little practice doing these methods with a new data set. For this, I'm going to invite you to do K means on a very well-known clustering dataset, the iris dataset, as an iris flowers. I'm going to invite you to import and prepare the iris dataset to conduct a K means cluster analysis with a value of three and then visualize the clusters. To do that, we'll import these libraries and then I've saved the iris dataset as a local CSV file in our data folder and let's take a look at the first few rows. What we have by the way are 150 observations of three different species of iris flowers. And we have the species located here in the last column and we have four physical measurements: the sepal length and width and the petal length and width. And from that, you can see how well you can predict the three different species. Give that a try, do the k-means algorithm…

Contents