Skip to Content
Practical Predictive Analytics
book

Practical Predictive Analytics

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

An age decision tree

Grow a simple decision tree to predict whether a passenger survived using Age as an independent variable and then plot the tree:

library(rpart) library(rpart.plot) set.seed(123) fit <- rpart(as.factor(Survived) ~ Age,  data=titanic,   method="class") rpart.plot(fit,extra=102) 

How accurate was this simple tree? Just to flex our brain, we will compute this manually.

At the console, compute the correct classification percentages. The correct number of predictions for each class is shown as the first number in each node in the preceding plot. The second number is the total number assigned to that class.

By adding up the total ...

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