Description Usage Arguments Examples
Cross validation with a classification model built by caret
1 |
df |
Dataframe containing the outcome and features to train model |
method |
Model type used by caret |
n |
number of cross validations to run |
formula |
a string to represent model formula used by caret |
data_test |
test data set |
outcome_var |
a string to indicate the outcome variable name |
1 2 3 4 5 6 7 | iris_select=iris%>%filter(Species %in% c('setosa','versicolor'))
iris_select$Species=as.character(iris_select$Species)
library(caret)
train_index=createDataPartition(iris_select$Species,times = 1,p = 0.8)$Resample1
data_test=iris_select[-train_index,]
data_train=iris_select[train_index,]
cv_caret(data_train,'rf',n=5,formula= 'Species~.',data_test=data_test,'Species')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.