Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
XGBoost & Random Forest: Decision Trees + Boosting in R
Role Play
Rating: 4.4 out of 5(53 ratings)
16,925 students

XGBoost & Random Forest: Decision Trees + Boosting in R

XGBoost, Random Forest, Decision Trees, Gradient Boosting, ROC Curve/AUC, Machine Learning in R (RStudio), rpart, party
Last updated 3/2026
English

What you'll learn

  • The algorithm behind recursive partitioning decision trees
  • Construct conditional inference decision trees with R`s ctree function
  • Construct recursive partitioning decision trees with R`s rpart function
  • Learn to estimate Gini´s impurity
  • Construct ROC and estimate AUC
  • Random Forests with R´s randomForest package
  • Gradient Boosting with R´s XGBoost package
  • Deal with missing data

Course content

7 sections73 lectures5h 57m total length
  • Welcome to the Course!2:53
  • Improving Your Learning Experience2:27
  • Important: the code is in the resources of lesson 12!0:13
  • Section Introduction0:47

    Explore the theoretical foundations of decision trees, including bagging and boosting, through a hands-on classification exercise using a hair attacks dataset and the recursive partition algorithm.

  • Introduction to Decision Trees6:14
  • Building a Decision Tree. Part A.6:17

    Learn how to build a decision tree by filtering predictors like chest pain and exercise induced angina, build contingency tables for heart attack predictions, and evaluate impurity to select root.

  • Building a Decision Tree. Part B.7:10
  • Building a Decision Tree. Part C.7:47

    Build a decision tree by evaluating Gini impurity for chest pain and exercise induced angina, selecting blocked arteries as the left node and comparing weighted impurities for prediction.

  • Building a Decision Tree. Part D.6:55
  • [Assignment] Builidng the Right Side of the Decision Tree

Requirements

  • There are no specific prerequisites for this course. It is designed to cater to both beginners and those with prior experience in spreadsheet analysis and R programming. However, having a basic understanding of these skills is recommended to fully benefit from the course content. Here is a list of recommended skills, tools, experience, and equipment for students:
  • Basic knowledge of spreadsheets: It is helpful to have familiarity with basic spreadsheet concepts such as formulas, functions, and data manipulation. If you are new to spreadsheets, don't worry, as an introduction to the necessary concepts will be provided.
  • Basic knowledge of R: While prior experience in R is not essential, having a basic understanding of R programming will enable you to follow the instructions and examples provided in the course. If you are new to R, explanations and additional resources will be provided to help you become acquainted with the environment.
  • Computer with access to R: To practice and complete exercises in the course, you will need access to a computer with R installed. Instructions for installing R will be provided in case you don't have it set up already.
  • Motivation and willingness to learn: This course requires dedication and practice to grasp the concepts and apply them effectively. Having a proactive attitude and being willing to work on exercises and challenges throughout the course is recommended.
  • Don't let the lack of prior experience be a barrier to joining this course. It is designed to be accessible and understandable for both beginners and those looking to strengthen their skills in the field of machine learning. Come and join us on this exciting learning journey!

Description

Do you want to build predictive models with machine learning—and actually understand what’s happening under the hood?

Welcome to “Decision Trees, Random Forests, and Gradient Boosting in R.” This is a hands-on, learning-by-doing course where you’ll work with real datasets and build models step by step, using the most important tree-based methods in applied machine learning.

I’m Carlos Martínez (Ph.D., University of St. Gallen). I designed this course to be practical, structured, and rigorous, so you can go beyond “running code” and gain the judgment you need to build, tune, and evaluate models properly.

What you’ll learn

By the end of the course, you’ll be able to:

  • Understand how recursive partitioning works (the logic behind decision trees)

  • Build trees in R using rpart and ctree (conditional inference trees)

  • Control complexity, reduce overfitting, and improve generalization using:

    • complexity parameter (cp)

    • pruning strategies

  • Apply and compare two high-performance ensemble methods:

    • Random Forests

    • Gradient Boosting

  • Evaluate predictive performance using ROC curves and AUC, so you can compare models with a robust metric

What’s included

  • Video lessons + structured explanations

  • Real datasets and all course code (R scripts)

  • Practice assignments + detailed solutions, so you can self-check and build confidence

Who this course is for

  • University students and professionals who want practical machine learning skills

  • Analysts working in business intelligence, analytics, finance, operations, or data roles

  • Anyone who wants to learn tree-based modeling properly, from fundamentals to evaluation

Prerequisites

  • Basic comfort with spreadsheets

  • Basic familiarity with R (you don’t need to be advanced)

What students say

  • Stefan L.: “Even though the topic was new to me, the course is easy to understand and the RStudio exercises work as explained.”

  • Frank B.: “Very beneficial… well organized and easy to understand. It gave me new ideas to assess model validity.”

  • Steven H.: “A very good review before my test tomorrow.”

  • Al M.: “Excellent.”

If you want a clear, practical path to mastering decision trees and modern ensembles in R—and learning how to evaluate them correctly—this course is for you.

Enroll today, and I’ll see you in the first lesson.

Who this course is for:

  • This course is aimed at students and professionals who are interested in expanding their knowledge and skills in machine learning and business intelligence. The content is designed to be accessible to individuals with varying levels of experience, making it suitable for both beginners and those with prior knowledge in the field. The ideal students for this course may include:
  • University students: Those pursuing degrees in fields such as data science, computer science, business analytics, or related disciplines can benefit from this course to enhance their understanding of machine learning algorithms and their practical application.
  • Working professionals: Individuals already employed in roles that involve data analysis, business intelligence, or decision-making can leverage this course to upskill and stay updated with the latest techniques and methodologies in predictive modeling using decision trees, random forests, and gradient boosting.
  • Data enthusiasts: If you have a passion for data analysis and are eager to dive into the world of machine learning, this course provides a solid foundation. It caters to individuals who may not have extensive experience in the field but are motivated to learn and apply predictive modeling techniques in their work or personal projects.
  • Research scholars: For those pursuing research in fields related to machine learning, this course can serve as a valuable resource to deepen their understanding of decision trees, ensemble methods, and evaluation metrics for predictive models.