SVM

svm(
  data_train,
  data_test,
  kernel = "linear",
  degree = 3,
  poly = 0,
  includeplot = FALSE
)

Arguments

data_train

Training set: dataframe containing classification column and all other columns features. This is the dataset on which the decision tree model is trained.

data_test

Test set: dataframe containing classification column and all other columns features. This is the dataset on which the decision tree model in tested.

kernel

Type of kernel to use for SVM model (default:linear)

degree

Degree for kernel used (in polynomial or radial case)

poly

Binary parameter stating whether the chosen kernel is polynomial of degree greater than 1 (default:0)

includeplot

Show performance scatter plot (default:FALSE)

Value

List containing performance percentages, accessed using training (training accuracy), test (test accuracy), trainsensitivity, testsensitivity, trainspecificity, testspecificity.

Examples

data_train = data.frame( classification=as.factor(c(1,1,0,0,1,1,0,0,1,1)), A=c(1,1,1,0,0,0,1,1,1,0), B=c(0,1,1,0,1,1,0,1,1,0), C=c(0,0,1,0,0,1,0,0,1,0)) data_test = data.frame( classification=as.factor(c(1,1,0,0,1,1,1,0)), A=c(0,0,0,1,0,0,0,1), B=c(1,1,1,0,0,1,1,1), C=c(0,0,1,1,0,0,1,1)) svm(data_train,data_test,kernel='radial',degree=3)
#> $test #> [1] 0.625 #> #> $testsensitivity #> [1] 0 #> #> $testspecificity #> [1] 0 #> #> $training #> [1] 0.6 #> #> $trainsensitivity #> [1] 0 #> #> $trainspecificity #> [1] 0 #>
svm(data_train,data_test,kernel='sigmoid')
#> $test #> [1] 0.625 #> #> $testsensitivity #> [1] 0 #> #> $testspecificity #> [1] 0 #> #> $training #> [1] 0.6 #> #> $trainsensitivity #> [1] 0 #> #> $trainspecificity #> [1] 0 #>
svm(data_train,data_test,kernel='poly',degree=4,poly=1)
#> $test #> [1] 0.625 #> #> $testsensitivity #> [1] 0 #> #> $testspecificity #> [1] 0 #> #> $training #> [1] 0.6 #> #> $trainsensitivity #> [1] 0 #> #> $trainspecificity #> [1] 0 #>