I'm training two SVM models using two differnt packages on my data and getting vastly different results. Is this something to be expected?
model1 using e1071
library('e1071')
model1 <- svm(myFormula, data=trainset,type='C',kernel='linear',probability = TRUE)
outTrain <- predict(model1, trainset, probability = TRUE)
outTest <- predict(model1, testset, probability = TRUE)
train_pred <- attr(outTrain, "probabilities")[,2]
test_pred <- attr(outTest, "probabilities")[,2]
calculateAUC(train_pred,trainTarget)
calculateAUC(test_pred,testTarget)
model2 using caret
model2 <- train(myFormula,data=trainset,method='svmLinear')
train_pred <- predict(model2, trainset)
test_pred <- predict(model2, testset)
calculateAUC(train_pred,trainTarget)
calculateAUC(test_pred,testTarget)
calculateAUC()
is a function I defined to calculate the AUC value, given the predicted and the actual values of the target.
I see the values as:
model1 (e1071)
1
0.8567979
model2 (caret)
0.9910193
0.758201
Is this something that is possible? Or am I doing this wrong?
I can provide sample data if that will be helpful