exploring & modeling using interactive decision trees in...

42
Copyright © 2013, SAS Institute Inc. All rights reserved. EXPLORING & MODELING USING INTERACTIVE DECISION TREES IN SAS® ENTERPRISE MINER™

Upload: vuongnga

Post on 29-Mar-2018

231 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

EXPLORING & MODELING USING INTERACTIVE

DECISION TREES IN SAS® ENTERPRISE MINER™

Page 2: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

ANALYTICS

LIFECYCLE

Formulate

ProblemData

Preparation

Data

Exploration

Transform

& SelectDevelop

Models

Validate

Models

Deploy

Model

Evaluate

& Monitor

Model

Page 3: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

ANALYTICS

LIFECYCLEDECISION TREES CAN HELP IN VARIOUS STAGES

Formulate

ProblemData

Preparation

Data

Exploration

Transform

& SelectDevelop

Models

Validate

Models

Deploy

Model

Evaluate

& Monitor

Model

Page 4: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

WHY DECISION TREES?

Page 5: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES ADVANTAGES

• Decision Trees are powerful predictive and explanatory

modeling tools

• They are flexible in that they are able to model targets

that are:

• Interval (regression trees)

• Ordinal, nominal and binary (classification trees)

• Trees can accommodate nonlinearities and interactions

• Trees are simple to understand and present

Page 6: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREE EASY TO VISUALIZE

Page 7: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES ENGLISH RULES

Node = 10

if Saving Balance >= 2615.09

AND Credit Card Balance < 641.915

then

Tree Node Identifier = 10

Number of Observations = 981

Predicted: INS=1 = 0.68

Predicted: INS=0 = 0.32

Page 8: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREE BACKGROUND

Page 9: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

WHAT ARE

DECISION TREES?

Decision trees are statistical

models designed for supervised

prediction problems.

The tree is fitted to data by recursive

partitioning. Partitioning refers to segmenting

the data into subgroups that are as

homogeneous as possible with respect to the

target.

Many algorithms – CHAID, CART, C4.5, C5.0

Page 10: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

2 TYPES OF

TREES

Classification tree – target is

categorical

Regression tree – target is

continuous

Page 11: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES CLASSIFICATION TREE

Page 12: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES MULTI-WAY SPLITS

Page 13: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES REGRESSION TREE

Page 14: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES PARTITIONED INPUT SPACE

Page 15: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES MULTIVARIATE STEP FUNCTION

Page 16: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES DECISION REGIONS

Page 17: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES LEAVES OF A CLASSIFICATION TREE

Page 18: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

USING DECISION TREES FOR INITIAL AND

EXPLORATORY DATA ANALYSIS

Page 19: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREESINITIAL DATA ANALYSIS AND EXPLORATORY DATA

ANALYSIS

• Interpretability

• No strict assumptions concerning the functional form of the

model

• Resistant to the curse of dimensionality

• Robust to outliers in the input space

• No need to create dummy variables for nominal inputs

• Missing values do not need to be imputed

• Computationally fast (usually)

Page 20: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

USING DECISION TREES TO MODIFY INPUT

SPACE

Page 21: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES MODIFYING THE INPUT SPACE

• Dimension Reduction

• Input subset selection

• Collapsing levels of nominal inputs

• Dimension Enhancement

• Discretizing interval inputs

• Stratified modeling

Page 22: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES INPUT SELECTION

Page 23: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES COLLAPSING LEVELS

Page 24: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

INTERACTIVE DECISION TREES IN SAS®

ENTERPRISE MINER™

Page 25: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES INTERACTIVE TRAINING

• Force and remove inputs

• Define split values

• Manually prune branches

and leaves

Page 26: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREE INTERACTIVE DECISION TREE

TIP: Prior to invoking

interactive mode,

modify the Decision

Tree properties to

reflect the type of tree

you wish to build.

Page 27: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

BUILDING SEGMENTATION TREES

Page 28: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DECISION TREES SEGMENTATION TREES WITH MULTIPLE TARGETS

Interactively build trees while considering more than one target.

Page 29: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

DEMONSTRATION

Page 30: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

ADDITIONAL DECISION TREES

Page 31: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

SAS® ENTERPRISE

MINER™BAGGING/BOOSTING TREES

Use Start Groups &

End Groups Nodes

Page 32: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

SAS® ENTERPRISE

MINER™GRADIENT BOOSTING

Sequential ensemble of

many trees

Extremely good

predictions

Very effective at variable

selection

Page 33: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

SAS® ENTERPRISE

MINER™RANDOM FOREST

• Predictive Model called a Forest

• Creates Several Trees

• Training Data sampled without

replacement

• Input variables sampled

Available in EM 13.1

Page 34: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

TIPS AND RESOURCES

Page 35: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

TIP INTERACTIVE DECISION TREE

• The Interactive Decision Tree may not use all of your data.

• It uses a sample of at most 20,000 observations to prevent the

excessive time and memory consumption that can occur with large

data sets.

• You can control the size and method for creating the sample with

Project Start Code

Page 36: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

TIP INTERACTIVE DECISION TREE

%let EM_INTERACTIVE_TREE_MAXOBS= <max-

number-of-observations-in-sample>;

%let

EM_INTERACTIVE_TREE_SAMPLEMETHOD=<RANDOM |

FIRSTN | STRATIFY>;

Page 37: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

TIP INTERACTIVE DECISION TREE

%let EM_INTERACTIVE_TREE_MAXOBS = 100000;

%let EM_INTERACTIVE_TREE_SAMPLEMETHOD =

RANDOM;

Page 38: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

LEARNING MORE DOCUMENTATION

• SAS® Enterprise Miner™ In-product Help File

• Documentation: • http://support.sas.com/documentation/onlinedoc/miner/index.html

• Getting Started with SAS® Enterprise Miner™• Documentation PDF

• Sample Data ZIP

• Recorded Webinar: http://www.sas.com/reg/web/corp/1864003

Page 39: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

LEARNING MORE SAS EDUCATION COURSES

Decision Tree Modeling

https://support.sas.com/edu/schedules.html?ctry=us&id=1463

Data Mining Techniques: Theory and Practice

https://support.sas.com/edu/schedules.html?ctry=us&id=1244

Page 40: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

LEARNING MORE SAS PRESS

Page 41: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d .

LEARNING MORE SAS PRESS

Decision Trees for Analytics Using SAS

Enterprise Miner

By: Barry de Ville and Padraic Neville

ISBN: 978-1-61290-315-6

Copyright Date: July 2013

SAS Bookstore:

https://support.sas.com/pubscat/bookdetails.jsp?catid=

1&pc=63319

Table of Contents [PDF]

Free Chapter [PDF]

Example Code and Data

Page 42: Exploring & Modeling Using Interactive Decision Trees in …nebsug.org/wp-content/uploads/2014/05/Rush_Exploring...Title Exploring & Modeling Using Interactive Decision Trees in SAS®

Copyr i g ht © 2013, SAS Ins t i tu t e Inc . A l l r ights reser ve d . www.SAS.com

THANK YOU FOR USING SAS