Displaying 2 results from an estimated 2 matches for "p_df".
Did you mean:
d_df
2010 May 11
1
how to extract the variables used in decision tree
HI, Dear R community,
How to extract the variables actually used in tree construction? I want to
extract these variables and combine other variable as my features in next
step model building.
> printcp(fit.dimer)
Classification tree:
rpart(formula = outcome ~ ., data = p_df, method = "class")
Variables actually used in tree construction:
[1] CT DP DY FC NE NW QT SK TA WC WD WG WW YG
Root node error: 608/1743 = 0.34882
n= 1743
CP nsplit rel error xerror xstd
1 0.185033 0 1.00000 1.00000 0.032726
2 0.052632 2 0.62993 0.65132 0.0...
2010 May 12
1
exact the variables used in tree construction
> fit.dimer <- rpart(as.factor(out) ~ ., method="class", data=p_df)
>
> fit.dimer$frame[, "var"]
[1] NE WC <leaf> TA <leaf> <leaf> WG WD WW WC
[11] <leaf> <leaf> <leaf> CT <leaf> FC <leaf> YG QT <leaf>
[21] <leaf> <leaf> NW DP DY &...