“I found Dataquest’s approach refreshingly different. Dataquest finds a balance between being too easy and being so hard that you get discouraged.”

Francisco Sosa

Sr. Data Scientist

Course overview

In this course, you’ll learn key concepts such as KNN Algorithms (K-Nearest Neighbors), error metrics including the Mean Squared Error and the Root Mean Squared Error and caret, a machine learning library for the R programming language. You’ll learn how to optimize machine learning algorithms for better accuracy and performance of trained models using hyperparameter optimization.

You’ll then dig into performing rigorous model testing using k-fold cross-validation. As you learn these new skills, you’ll be working with AirBnB prices data from Washington D.C. to predict the optimal price for generating profit from a Washington D.C. home rental.

Best of all, you’ll learn by doing — you’ll practice and get feedback directly in the browser. At the end of the course, you’ll complete a project to predict car prices using the K-Nearest Neighbors algorithm. This project is a chance for you to combine the skills you learned in this course and practice a machine learning workflow.

Key skills

  • Understanding the key concepts of machine learning and common pitfalls
  • Identifying a proper machine learning workflow
  • Implementing the k-nearest neighbors algorithm
  • Employing the caret library

Course outline

Introduction to Machine Learning in R [6 lessons]

Introduction to Machine Learning Concepts 1h

Lesson Objectives
  • Establish a machine learning workflow
  • Identify how the k-nearest neighbors algorithm works
  • Define the role of Euclidean distance in the k-nearest neighbors algorithm

Evaluating Model Performance 1h

Lesson Objectives
  • Employ the caret library to carry out the machine learning process
  • Evaluate model performance using RMSE
  • Compare RMSE values between different models

Multivariate K-Nearest Neighbors 1h

Lesson Objectives
  • Incorporate multiple features into your k-nearest neighbor model
  • Perform more involved data cleaning through normalization
  • Employ piping to create easy-to-digest summaries of your model performance

Cross Validation 1h

Lesson Objectives
  • Define holdout and k-fold cross-validation
  • Analyze model performance using k-fold cross-validation
  • Perform k-fold cross-validation in caret

Hyperparameter Optimization 1h

Lesson Objectives
  • Identify how tuning model hyperparameters can affect the model performance
  • Optimize for the best hyperparameter value using grid search
  • Employ caret to perform hyperparameter optimization

Guided Project: Predicting Car Prices 1h

Lesson Objectives
  • Implement the machine learning workflow on a new dataset
  • Employ caret to carry out the entire machine learning workflow
  • Explore making models

Projects in this course

Guided Project: Predicting Car Prices

For this project, we’ll step into the role of data scientists to predict car prices using the k-nearest neighbors algorithm and R, practicing the machine learning workflow on a real dataset.

The Dataquest guarantee


Dataquest has helped thousands of people start new careers in data. If you put in the work and follow our path, you’ll master data skills and grow your career.


We believe so strongly in our paths that we offer a full satisfaction guarantee. If you complete a career path on Dataquest and aren’t satisfied with your outcome, we’ll give you a refund.

Master skills faster with Dataquest

Go from zero to job-ready

Go from zero to job-ready

Learn exactly what you need to achieve your goal. Don’t waste time on unrelated lessons.

Build your project portfolio

Build your project portfolio

Build confidence with our in-depth projects, and show off your data skills.

Challenge yourself with exercises

Challenge yourself with exercises

Work with real data from day one with interactive lessons and hands-on exercises.

Showcase your path certification

Showcase your path certification

Share the evidence of your hard work with your network and potential employers.

Grow your career with

of learners recommend
Dataquest for career advancement
Dataquest rating
SwitchUp Best Bootcamps
Average salary boost
for learners who complete a path

Aaron Melton

Business Analyst at Aditi Consulting

“Dataquest starts at the most basic level, so a beginner can understand the concepts. I tried learning to code before, using Codecademy and Coursera. I struggled because I had no background in coding, and I was spending a lot of time Googling. Dataquest helped me actually learn.”


Jessica Ko

Machine Learning Engineer at Twitter

“I liked the interactive environment on Dataquest. The material was clear and well organized. I spent more time practicing then watching videos and it made me want to keep learning.”


Victoria E. Guzik

Associate Data Scientist at Callisto Media

“I really love learning on Dataquest. I looked into a couple of other options and I found that they were much too handhold-y and fill in the blank relative to Dataquest’s method. The projects on Dataquest were key to getting my job. I doubled my income!”

Join 1M+ data learners on


Create a free account


Choose a learning path


Complete exercises and projects


Advance your career

Start learning today