Reputation: 5535
I want to create a toy 2D dataset on which to visualize the performance of the SVM algorithm. I produced a dataset which is perfectly separable:
n <- 200;
d<-data.frame(x=runif(n), y=runif(n))
d$class[-1 + 3 * d$x < d$y] <- "1"
d$class[-1 + 3 * d$x > d$y] <- "2"
However, I don't understand the warnings I get when I run the line:
library(caret)
train(class~., data=d, method='svmLinear', tuneGrid=data.frame(C=1))
The method returns a lot of warnings, all of the type:
23: In data.row.names(row.names, rowsi, i) :
some row.names duplicated: 3,4,10,12,14,16,18,22,24,27,30,34,35,38,39,45,47,52,54,56,57,64,67,72,74,76,78,81,83,84,87,88,91,92,94,99,103,108,109,111,113,115,117,118,120,121,123,128,129,131,135,137,138,140,141,143,145,146,148,153,164,171,173,178,181,187,189,191,193,194,198 --> row.names NOT used
Furthermore,
Can anyone explain what in the world is happening?
Upvotes: 0
Views: 74
Reputation: 23598
There is nothing wrong with your model and works fine. You can ignore the warning.
This issue was filed under issue 410 on the github page of caret. This is now resolved and will be fixed when a new version is available on cran (version higher than 6.0-70). Or you can download a new version from github.
Upvotes: 1
Reputation: 2832
Well, I am not sure about what is causing the warnings. But when I used other approach to fit model using train function as below:
train(x=d[, c("x", "y")], y=factor(d$class), method='svmLinear', tuneGrid=data.frame(C=1)
I did not get any warnings. The performance of both the methods, is very much same.
Upvotes: 1