-
Notifications
You must be signed in to change notification settings - Fork 0
/
CV.R
executable file
·36 lines (25 loc) · 884 Bytes
/
CV.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
34
35
#################################################################################
######################################### Fine - tuning #########################
#################################################################################
if(.Platform$OS.type == "unix") {
setwd("/bb/airbnb")
}else {
setwd("C://bb//airbnb")
}
source('LoadDataframes.R')
library(randomForest)
library(doParallel)
library(mlbench)
library(caret)
cls = makeCluster(8)
registerDoParallel(cls)
# Random Search
control <- trainControl(method="repeatedcv", number=10, repeats=3, search="random", verboseIter = TRUE, allowParallel = TRUE)
set.seed(123)
metric <- "Accuracy"
mtry <- sqrt(ncol(train))
ptm3 <- proc.time()
rf_random <- train(occupied_cat~., data=train, method="rf", metric=metric, tuneLength=15, trControl=control)
ptm4 <- proc.time()
print(ptm4 - ptm3)
print(rf_random)