We use cookies, including third-party cookies from Google to serve personalized ads through AdSense, to operate this site and understand how it is used. By continuing to browse, you accept this use. See our Privacy Policy and Terms of Use for details, including how to opt out of personalized advertising.
Accept
SmartData CollectiveSmartData Collective
  • Analytics
    AnalyticsShow More
    What Kind of Problem-Solving Distinguishes Data Analysts From Software Engineers -- AI-generated illustration
    What Kind of Problem-Solving Distinguishes Data Analysts From Software Engineers
    7 Min Read
    chatgpt image jul 21, 2026, 04 34 30 pm
    4 Core Benefits of Predictive Maintenance after Vibration Analysis
    10 Min Read
    How Does Data Mining Boost Customer Satisfaction in Logistics? Harnessing Analytics for Results -- AI-generated illustration
    How Does Data Mining Boost Customer Satisfaction in Logistics? Harnessing Analytics for Results
    11 Min Read
    chatgpt image jul 13, 2026, 04 23 45 pm
    How Data Analytics Helps Companies Improve User Engagement
    19 Min Read
    chatgpt image jul 13, 2026, 03 59 46 pm
    How Data Analytics Improves Multi-Location Search Strategies
    10 Min Read
  • Big Data
  • BI
  • Exclusive
  • IT
  • Marketing
  • Software
Search
© 2008-25 SmartData Collective. All Rights Reserved.
Reading: How to Calculate R-squared for a Decision Tree Model
Share
Notification
Font ResizerAa
SmartData CollectiveSmartData Collective
Font ResizerAa
Search
  • About
  • Help
  • Privacy
Follow US
© 2008-23 SmartData Collective. All Rights Reserved.
SmartData Collective > Data Management > Best Practices > How to Calculate R-squared for a Decision Tree Model
Best PracticesDecision Management

How to Calculate R-squared for a Decision Tree Model

MichaelBerry
MichaelBerry
4 Min Read
How to Calculate R-squared for a Decision Tree Model
Illustrative image generated with OpenAI gpt-image-1.
SHARE

A client recently wrote to us saying that she liked decision tree models, but for a model to be used at her bank, the risk compliance group required an R-squared value for the model and her decision tree software doesn’t supply one. How should she fill in the blank? There is more than one possible answer.

Start with the definition of R-squared for regular (ordinary least squares) regression. There are three common ways of describing it. For OLS they all describe the same calculation, but they suggest different ways of extending the definition to other models. The calculation is 1 minus the ratio of the sum of the squared residuals to the sum of the squared differences of the actual values from their average value.

The denominator of this ratio is the variance and the numerator is the variance of the residuals. So one way of describing R-squared is as the proportion of variance explained by the model.

A second way of describing the same ratio is that it shows how much better the model is than the null model which consists of not using any information from the explanatory variables and just predicting the average. (If you are always going to guess the same value, the average is the value that minimizes the squared error.)

More Read

Why Human Resource Should Care About Big Data
Why Human Resource Should Care About Big Data
Customer Data Integration – Separating the Hype from the Reality
Blasphemy? Quantitative Approaches Don’t Always Work Best
How Data Is Helping Sports Teams Increase ROI, Even in Off-Season
Predictive Analytic Strategies to Out-Predict the Competition

Yet a third way of thinking about R-squared is that it is the square of the correlation r between the predicted and actual values. (That, of course, is why it is called R-squared.)

Back to the question about decision trees: When the target variable is continuous (a regression tree), there is no need to change the definition of R-squared. The predicted values are discrete, but everything still works.

When the target is a binary outcome, you have a choice. You can stick with the original formula. In that case, the predicted values are discrete with values between 0 and 1 (as many distinct estimates as the tree has leaves) and the actuals are either 0 or 1. The average of the actuals is the proportion of ones (i.e. the overall probability of being in class 1).  This method is called Efron’s pseudo R-squared.

Alternatively, you can say that the job of the model is to classify things.  The null model would be to always predict the most common class. A good pseudo R-squared is how much better does your model do? In other words, the ratio of the proportion correctly classified by your model to the proportion of the most common class.

There are many other pseudo R-squares described on a page put up by the statistical consulting services group at UCLA.

Share This Article
Facebook Pinterest LinkedIn
Share

Follow us on Facebook

Latest News

Retailers Should Stop Treating Every Stockout as Equal -- AI-generated illustration
Retailers Should Stop Treating Every Stockout as Equal
Business Intelligence Exclusive
Best Vibe Coding Cleanup Specialists in the USA: Fix or Rebuild? -- AI-generated illustration
Best Vibe Coding Cleanup Specialists in the USA: Fix or Rebuild?
Development Exclusive
Using Warehouse, Transportation and Order Data to Plan Distribution-Center Capacity -- AI-generated illustration
Using Warehouse, Transportation and Order Data to Plan Distribution-Center Capacity
Big Data Exclusive
Flat editorial illustration: The article centers on AI budget discipline for 2027 business planning, linking AI spending to measu
10 AI Trends That Should Shape Your 2027 Business Plan
Artificial Intelligence Exclusive

Stay Connected

1.2KFollowersLike
33.7KFollowersFollow
222FollowersPin

You Might also Like

Top 5 Things Recruiters Should Ask Their Big Data
Best PracticesBig DataBusiness IntelligenceData ManagementDecision Management

Top 5 Things Recruiters Should Ask Their Big Data

10 Min Read
Harnessing Collective Intelligence in Decision Making through Big Data Analytics
AnalyticsBest PracticesData MiningPolicy and Governance

Harnessing Collective Intelligence in Decision Making through Big Data Analytics

27 Min Read
What to Do When You Don’t Know What You Don’t Know…
AnalyticsBusiness IntelligenceData QualityDecision Management

What to Do When You Don’t Know What You Don’t Know…

5 Min Read
Walled Gardens and the Value of Innovation: Questions for Bill Franks
AnalyticsBest PracticesDecision ManagementExclusiveKnowledge ManagementRisk Management

Walled Gardens and the Value of Innovation: Questions for Bill Franks

6 Min Read

SmartData Collective is one of the largest & trusted community covering technical content about Big Data, BI, Cloud, Analytics, Artificial Intelligence, IoT & more.

5 Great Tips for Using Data Analytics for Website UX
5 Great Tips for Using Data Analytics for Website UX
Big Data
The Art of Conversation: Enhancing Chatbots with Advanced AI Prompts
The Art of Conversation: Enhancing Chatbots with Advanced AI Prompts
Chatbots

Quick Link

  • About
  • Contact
  • Privacy
Follow US
© 2008-26 SmartData Collective. All Rights Reserved.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?