Closed gilad19 closed 7 years ago
Hi,
Thanks. I actually interested in both (kernlab::ksvm and e1071::svm). I guess if I was asked to choose I would pick kernlab::ksvm but it doesn't really matter (by the way, if I am not wrong the type of ksvm is "one-svc").
Thank again!
Decided to implement the e1071::svm()
function first - it's based on a popular LibSVM implementation, and it supports model specification via the "formula" interface.
The r2pmml
package encodes one-class SVM similarly to Scikit-Learn's OneClassSVM
class - a regression-type model, which computes two results:
decisionFunction
(continuous double): distance to the separating plane. Inliers have positive values, outliers have negative values. The greater the value, the more typical or atypical, respectively, the data record is.outlier
(categorical boolean): outlier = (decisionFunction < 0 ? true : false)
.Example R code:
library("e1071")
library("r2pmml")
data(iris)
iris.simple = svm(~ . - Species, data = iris, type = "one-classification")
r2pmml(iris.simple, "iris-simple.pmml", dataset = iris)
iris.complex = svm(~ . - Species + I(Sepal.Length / Sepal.Width) + I(Petal.Length / Petal.Width), data = iris, type = "one-classification")
iris.complex$xlevels = list(names = c())
r2pmml(iris.complex, "iris-complex.pmml", dataset = iris)
In addition to one-class SVM, the r2pmml
package is now able to convert "ordinary" regression and classification SVM as well.
Great, thanks a lot!!!
Is it possible to apply r2pmml for another type like c-classification?
@korczykowska If you have questions, then please open new issue(s), instead of "reusing" old and already closed issues.
Here is a list of supported e1071::svm
parameterizations: https://github.com/jpmml/jpmml-r/blob/master/src/test/R/svm.R
By scrolling through this code, I can't tell right away if C-classification
is already supported or not (perhaps it's the default for all classifiers). Again, it's your responsibility to provide with a reproducible test case that it's not supported at the moment (sorry, I'm busy working on many things, and I don't have time to verify each claim made against the project).
Can you clarify, which R package/function interests you? Is it
kernlab::ksvm(.., type = "one-svm")
,e1071::svm(.., type = "one-classification")
, or something completely different?