-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfMultipleClassificationModels.R
More file actions
executable file
·36 lines (31 loc) · 1.1 KB
/
fMultipleClassificationModels.R
File metadata and controls
executable file
·36 lines (31 loc) · 1.1 KB
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
library(caret)
fMultipleClassificationModels <- function(Formula, TrainingData, TrainingControl, EvalMetric, TrainingModels) {
AllModels <- lapply(TrainingModels, function(x) {
set.seed(3)
TrainedModel <- train(Formula,
TrainingData,
method = x,
metric = EvalMetric,
trControl = TrainingControl
# family = "binomial" #only for glm method
)
return(TrainedModel)
})
return(AllModels)
}
# fMultipleClassificationModels <- function(TrainingData, TrainingLabels, TrainingControl, EvalMetric, TrainingModels) {
# AllModels <- lapply(TrainingModels, function(x) {
# set.seed(3)
# TrainedModel <- train(TrainingData,
# TrainingLabels,
# method = x,
# metric = EvalMetric,
# trControl = TrainingControl
# # family = "binomial" #only for glm method
# )
#
# return(TrainedModel)
# })
#
# return(AllModels)
# }