by using predict(model.ksvm, validationset, ...) I am facing following error: "Error: '...' used in an incorrect context" And I want to use regression in SVM what can I do for it.
Thanks Abbas --- On Tue, 9/8/09, Abbas R. Ali <abba...@yahoo.com> wrote: From: Abbas R. Ali <abba...@yahoo.com> Subject: [R] Regarding SVM using R To: r-help@r-project.org Date: Tuesday, September 8, 2009, 6:09 PM Hi Steve I am facing a little problem in predict function which is I think mismatch of dimension. Infacted area is covered by ***. svm = function() { library(RODBC) # load RODBC library for database access channel = odbcConnect("demo_dsn", "sa", "1234") # connecting to the database with the dabtabase data = sqlQuery(channel, "SELECT top 100 * FROM [Demographics].[dbo].[CHA_Training]") odbcClose(channel) # close the database connection index = 1:nrow(data) # getting a vector of same size as data sample_index <- sample(index, length(index) / 3) # samples of the above vector training <- data[-sample_index, ] # 2/3 training data validation <- data[sample_index, ] # 1/3 test data x = training[, length(training)] # seperating class labels model.ksvm = ksvm(x, data = training, kernel = "rbfdot", kpar= list(sigma = 0.05), C = 5, cross = 3) # train data through SVM ******************************************************************* Problamisitc area: prSV = predict(model.ksvm, validation[, -length(validation)], type = "decision") # validate data Error: Error in .local(object, ...) : test vector does not match model ! Notes: If I modified the predict function as "prSV = predict(model.ksvm, validation[, length(validation)], type = "decision")" then it works but its not correct. ***************************************************************** table(prSV, validation[, length(validation)]) # draw table } Thanks Abbas -----Inline Attachment Follows----- ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.