Skip to content

Instantly share code, notes, and snippets.

@zunman
Created March 16, 2017 03:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zunman/660e9103c7c2a688692cc015fd631d62 to your computer and use it in GitHub Desktop.
Save zunman/660e9103c7c2a688692cc015fd631d62 to your computer and use it in GitHub Desktop.
#10-fold
ctrl <- trainControl(method = "repeatedcv", repeats = 10,
classProbs = TRUE,
summaryFunction = twoClassSummary)
##TRAINING
set.seed(5627)
orig_fit <- train(UserClass ~ ., data = imbal_train,
method = "svmLinear",
metric = "ROC",
preProc = c("center", "scale"),
trControl = ctrl)
##Confusion matrix - test
imbal_test$pred <- predict(orig_fit, imbal_test)
confusionMatrix(data = imbal_test$pred, reference = imbal_test$UserClass,positive = "yes", mode = "prec_recall")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment