-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsplit_run_forest.R
33 lines (27 loc) · 1.16 KB
/
split_run_forest.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# TX run forest...
# splits the data, runs two forests sequentially, then combines them
# scp "/Users/austinbean/Desktop/drgml/split_run_forest.R" [email protected]:/project/Lorch_project2018/bean/
# subset training since it may be too large:
dim1 = nrow(traind)
traind1 <- traind[1:floor(dim1/2),]
traind2 <- traind[(floor(dim1/2)+1):dim1,]
# train two forests:
forest_tst1 <- randomForest(ADMN_NICU~ .,
data=traind1,
ntree = tree_num,
do.trace=TRUE,
na.action=na.omit,
proximity=FALSE,
nodesize=100,
importance=TRUE)
forest_tst2 <- randomForest(ADMN_NICU~ .,
data=traind2,
ntree = tree_num,
do.trace=TRUE,
na.action=na.omit,
proximity=FALSE,
nodesize=100,
importance=TRUE)
# combine them:
library(randomForest)
forest_tst <- forest_combine(forest_tst1, forest_tst2)