📜  svm e1071 截止 - Html (1)

📅  最后修改于: 2023-12-03 15:05:25.377000             🧑  作者: Mango

SVM - Support Vector Machine

Introduction

SVM (Support Vector Machine) is a supervised machine learning algorithm used for classification or regression tasks. SVM is based on finding the hyperplane in a high-dimensional space that separates the input data into two classes.

e1071

e1071 is an R package that provides functions for performing SVM classification, regression and density estimation. It extends the basic functionality of SVM by providing tools for parameter tuning, model selection, and cross-validation.

Installation

You can install e1071 package using the following command:

install.packages("e1071")
Usage
  1. SVM Classification:
library(e1071)
data(iris)
svmModel <- svm(Species~., data = iris)
summary(svmModel)
  1. SVM Regression:
library(e1071)
data(marathon)
svmModel <- svm(Marathon ~., data = marathon, kernel = "radial")
summary(svmModel)
  1. SVM with Cross-Validation:
library(e1071)
data(BostonHousing)
svmTune <- tune.svm(medv ~., data = BostonHousing, kernel = "linear", ranges = list(cost = c(0.1, 1, 10), epsilon = c(0.01, 0.1)))
summary(svmTune)
Conclusion

e1071 is a powerful tool for performing SVM classification, regression, and density estimation. It provides a wide range of options for parameter tuning and model selection, allowing you to build accurate and robust models for your data.