Skip to Content
Practical Predictive Analytics
book

Practical Predictive Analytics

by Ralph Winters
June 2017
Beginner to intermediate
576 pages
15h 22m
English
Packt Publishing
Content preview from Practical Predictive Analytics

An alternative decision tree

Let's say we arbitrarily selected another simple decision tree model; this time we will predict whether or not a passenger survived based upon the passenger class variable:

This is a slightly more complex tree, since it has four branches and three terminal nodes. Now, let's calculate the correct classification rate for the model by adding up the correct classification numbers for the three nodes and dividing this by the total number of rows, as we did before:

> (270+90+122) / nrow(titanic) 

This is the following output:

[1] 0.67507 > 

This simple model is even better, with a 67% correct classification.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Superstream: Analytics Engineering

Data Superstream: Analytics Engineering

Alistair Croll, Anna Filippova, Emilie Schario, Lewis Davies, Jacob Frackson, Benn Stancil, Nick Acosta, Elizabeth Caley
R: Predictive Analysis

R: Predictive Analysis

Tony Fischetti, Eric Mayor, Rui Miguel Forte
Python: Advanced Predictive Analytics

Python: Advanced Predictive Analytics

Ashish Kumar, Joseph Babcock

Publisher Resources

ISBN: 9781785886188Supplemental Content