| wrap_svm | R Documentation |
Fits an 'e1071' support vector machine with a consistent interface. Supports classification and regression.
wrap_svm(x, y, ...)
## S3 method for class 'wrap_svm'
predict(object, newx, type = c("class", "prob"), ...)
## S3 method for class 'wrap_svm'
print(x, ...)
x |
A matrix or data.frame of features. |
y |
A factor or character vector for classification, numeric for regression. |
... |
Additional arguments passed to [e1071::svm()]. 'probability = TRUE' is set automatically for classification; do not override this if you need 'type = "prob"' predictions. |
object |
A fitted 'wrap_svm' object. |
newx |
A matrix or data.frame of new observations. |
type |
'"class"' (default) for class labels, '"prob"' for a probability matrix. Ignored for regression. |
An object of class 'wrap_svm' with fields:
fit |
The fitted svm model. |
levels |
Class levels (NULL for regression). |
task |
"classification" or "regression". |
X <- as.matrix(iris[, 1:4])
y <- iris$Species
mod <- wrap_svm(X, y, kernel = "radial")
predict(mod, newx = X, type = "class")
predict(mod, newx = X, type = "prob")
X <- as.matrix(iris[, 1:4])
y <- iris$Species
mod <- wrap_svm(X, y, kernel = "radial")
predict(mod, newx = X, type = "class")
predict(mod, newx = X, type = "prob")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.