Skip to contents

Wraps e1071::svm.

Usage

morie_svm_kernel_trick(
  x,
  y,
  kernel = "rbf",
  C = 1,
  gamma = "scale",
  degree = 3L,
  seed = 0L
)

Arguments

x

Numeric predictor matrix.

y

Binary response.

kernel

One of "rbf" (radial), "poly", "sigmoid", "linear".

C

Cost parameter.

gamma

Kernel coefficient ("scale" -> 1/(ncol(x)*var(x)), "auto" -> 1/p, or numeric).

degree

Polynomial degree.

seed

RNG seed.

Value

Named list: estimate, train_accuracy, n_support, kernel, C, gamma, degree, n, method.

Examples

morie_svm_kernel_trick(x = rnorm(50), y = rnorm(50))
#> $estimate
#> [1] 1
#> 
#> $train_accuracy
#> [1] 1
#> 
#> $n_support
#>  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [39] 1 1 1 1 1 1 1 1 1 1 1 1
#> 
#> $kernel
#> [1] "rbf"
#> 
#> $C
#> [1] 1
#> 
#> $gamma
#> [1] "scale"
#> 
#> $degree
#> [1] 3
#> 
#> $n
#> [1] 50
#> 
#> $method
#> [1] "Kernel SVM (rbf)"
#>