The arboretum procedure



Yüklə 3,07 Mb.
Pdf görüntüsü
səhifə4/148
tarix30.04.2018
ölçüsü3,07 Mb.
#40673
1   2   3   4   5   6   7   8   9   ...   148

10

The ARBORETUM Procedure

The SAVE statement specifies the output data sets. The SUMMARY= option outputs

summary statistics to the data set SUM1.

Figure 1

shows the result of printing the

SUM1 data set. The sum of square errors produces an R-square of 0.57.

Obs

STATISTIC

VALUE

1

N

395.00

2

AVERAGE

85700.17

3

AVE SQ ERR

7123521155.08

4

R SQUARED

0.57

Figure 1.

Summary Statistics



Selecting a Subtree

The SEQUENCE= option in the SAVE statement creates a SAS data set with statistics

for subtrees of every possible size. The number of leaves is stored in variable –NW–.

The variable –NW– is created in other SAS data mining procedures to represent the

complexity of a model. –NW– is an abbreviation for number of weights in a neural

network.


Figure 2

shows the output from printing the number of leaves and the assessment

measure from the SEQUENCE= data set. The default assessment measure for an

interval target is the average square error. The first observation shows the average

square error in the training data, before applying the tree. The first five observations

show that the average square error decreases quickly as the number of leaves in the

subtree increases from 1 to 5. The error decreases more slowly as the number of

leaves increases from 6 to 16.



proc print data=seq1 label;

var _NW_ _ASSESS_ ;

run;


Selecting a Subtree

11

Number



of

Subtree

Obs

Leaves

Assessment

1

1

16626478669.3

2

2

13780468465.0

3

3

9872157361.2

4

4

9025518133.9

5

5

8288990878.8

6

6

7633053644.4

7

7

7427061309.9

8

8

7238580477.6

9

9

7201752194.9

10

10

7170052669.6

11

11

7139810808.1

12

12

7131248315.7

13

13

7127223465.7

14

14

7124198471.6

15

15

7123655825.3

16

16

7123521155.1

Figure 2.

Subtree Sequence

The following PROC ARBORETUM code selects the subtree with 5 leaves and saves

the node statistics and splitting rules in SAS data sets:



proc arboretum inmodel=tree1 ;

subtree nleaves=5;

save model=tree2

summary=sum2

nodestats=nodes2

rules=rules2

;

run;

proc print data=sum2 label;

The INMODEL= option imports the information saved from the previous execution

of the ARBORETUM procedure, eliminating the need to respecify the training data

set or the variables or to re-create the tree. The SUBTREE statement selects the

subtree with five leaves. The NODESTATS= option in the SAVE statement saves

information about each node into data set NODES2. The RULES= option in the

SAVE statement saves all the splitting rules into data set RULES2.

Figure 3


shows the contents of the SUM2 data set:

Obs

STATISTIC

VALUE

1

N

395.00

2

AVERAGE

85700.17

3

AVE SQ ERR

8288990878.80

4

R SQUARED

0.50

Figure 3.

Summary Statistics for Subtree 5




12

The ARBORETUM Procedure

The R-square for the subtree with 5 leaves is 0.50, compared to 0.57 for the tree with

16 leaves.

The NODES2 data set contains information about each node.

The variable

P–SALES contains the predicted sales amount for observations in the node. In this

example, P–SALES equals the average sales among observations in the SHOES

data set assigned to the node. The WHERE statement in the following code selects

the leaf nodes for printing, excluding the nonterminal nodes.

Figure 4

shows the

output listing.

proc print data=nodes2;

var node leaf n p_sales;

where leaf ne .;

Obs

NODE

LEAF

N

P_Sales

2

2

1

202

33554.14

5

12

2

86

41364.47

6

13

3

38

146430.61

8

14

4

16

386879.94

9

15

5

53

221921.57

Figure 4.

Information about Each Leaf

The RULES2 data set contains all the splitting rules in the tree, including the unused

competing rules, and the candidate rules in the leaves. The WHERE statement in the

following code selects the primary rules for printing, and

Figure 5


shows the output

listing:


proc print data=rules2;

where role = ’PRIMARY’;


Yüklə 3,07 Mb.

Dostları ilə paylaş:
1   2   3   4   5   6   7   8   9   ...   148




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə