Skip to content

Help with RandomForest

2 messages · Steve_Friedman at nps.gov, Liaw, Andy

#
I'm working with the randomForest package and have successfully build a
model.  I'd like to go one step further however, and use the output from
the model to construct a map using the output.  My input data are spatial,
and I have an independent set of rasterize maps for each of the predictor
variables, to map the classification solution.

Using the getTree function:
labelVar = TRUE)

returns a  "list" with dim(tree)  451 rows x 6 columns.

I assume that other folks using this package and publishing maps have used
this list to link the left and right daughters, split variable, and the
split point back to a map.

Here is a brief example( just the first 6 rows)  of that list:
        left daughter right daughter split var        split point
status prediction
1             2                     3           TN                32.665
      1       <NA>
2             4                     5           TN                12.310
       1       <NA>
3             6                     7           BD                0.125
      1       <NA>
4             8                     9     Total_Mg          4218.000
 1       <NA>
5            10               11          LOI               92.475
1       <NA>
6            12               13    Total_Mg          831.000           1
<NA>


This is where I'm searching for a procedure to accomplish that.  If anyone
has a procedure I would greatly appreciate it if you would share that with
me.

Thanks
Steve


Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

Steve_Friedman at nps.gov
Office (305) 224 - 4282
Fax     (305) 224 - 4147
#
Steve,

It sounds to me like you want to use the model to predict data in other
maps.  If so, you should be using predict(), not getTree().  getTree()
shows the classification rules in _one_ of the trees in the forest
(default the first tree), which is rarely of interest if you've grown
hundreds of trees in the model, since the prediction is formed by
aggregating all the predictions from all the trees.

Best,
Andy
Notice:  This e-mail message, together with any attachme...{{dropped:11}}