Machine Learning in R: k-means Clustering on Iris Dataset

The k-means algorithm is a Machine Learning technique that falls under the Unsupervised Learning category. The essence of the K means algorithm is that it is left to itself to find interesting patterns in a given dataset. In this project, we will use the k-means algorithm to group the data from the popular Iris Dataset into a few clusters.

Join for $4.99
Machine Learning in R: k-means Clustering on Iris Dataset

Duration (mins)

Learners

5.0 / 5

Rating

Task List


We will cover the following tasks in 26 minutes:


Introduction

In this task, I will discuss the goal of the course, which is to use the k-means clustering algorithm to properly group three species of flowers given only the Petal Length and Petal Width. I will also discuss the dataset. We will go over the Rhyme Interface and I will turn on my Webcam and give you a short bio about me!


Exploratory Analysis

I suggest always doing some exploratory analysis on a dataset before embarking on any project. I will show you a few ways to go about exploratory analysis in this task. We will use the str() call, summary() call, and then use ggplot to graphically look at the data. Of course, there are many more techniques and depending on the project you may use these techniques or other techniques.


k-means

You can always look up the formula calls in the Help section by putting a question mark before the function. We will do that in this section with the k-means function. We will be using the dataframe, three centers and 20 nstarts. We can further explore the meaning of various arguments that we provide to the algorithm. We will also run the algorithm and store the trained k-means model in an object.


k-means Grouping (Graphically)

To see how the algorithm grouped the data graphically we need to first convert the clustered object into a factor. Then, it’s as easy as using ggplot on the original data and adding the cluster factors. I will show you how this is done in this task.


Accuracy

When looking at the accuracy visually we can usually do a decent job. However, if we need hard facts and hard data we will need to go a little further. This can be done using the table function. I will show you how to find out exactly how the algorithm performed using this function.

Watch Preview

Preview the instructions that you will follow along in a hands-on session in your browser.

Chris Shockley

About the Host (Chris Shockley)


I am an R enthusiast, hiker, and amateur astronomer. My favorite hike is located in Mt. Rainier National Park, my favorite Deep Sky Object is Alberio, and my favorite R package is dplyr (since I use it everyday). I have a dog named Coog (Lllasa Apso), and I love talking about Coog (as you'll find out soon). I work as a Data Analyst/Financial Analyst for a Metals Co. located in Seattle, WA. I have been in my current position for 4 years. I work primarily in R for Analytics and R Shiny for Deployment. I have built numerous apps over the past few years. My hope is that I can help you in learning R. Yes, the Rhyme Interface will help you. But. You also must take what you learn and practice, practice, practice. So... Let's get after it. See you soon.



Frequently Asked Questions


In Rhyme, all projects are completely hands-on. You don't just passively watch someone else. You use the software directly while following the host's (Chris Shockley) instructions. Using the software is the only way to achieve mastery. With the "Live Guide" option, you can ask for help and get immediate response.
Nothing! Just join through your web browser. Your host (Chris Shockley) has already installed all required software and configured all data.
You can go to https://rhyme.com/for-companies, sign up for free, and follow this visual guide How to use Rhyme to create your own sessions. If you have custom needs or company-specific environment, please email us at help@rhyme.com
Absolutely. We offer Rhyme for workgroups as well larger departments and companies. Universities, academies, and bootcamps can also buy Rhyme for their settings. You can select sessions and trainings that are mission critical for you and, as well, author your own that reflect your own needs and tech environments. Please email us at help@rhyme.com
Please email us at help@rhyme.com and we'll respond to you within one business day.

Ready to join this 26 minutes session?