Fits the dual soft-margin SVM by sequential minimal optimisation. Only the
kernel enters, never the feature map. Observations with alpha = 0 do not
appear in the decision function at all, which is what makes the solution
sparse in the training set; small C gives a wide margin and many support
vectors, large C a narrow one and few.
Usage
morie_esl_svm_kernel(
X,
y,
C = 1,
kernel = "rbf",
gamma = NULL,
degree = 3,
coef0 = 1,
newdata = NULL,
tol = 0.001,
max_passes = 50L,
seed = 0L
)Arguments
- X
Training predictors, n by p.
- y
Labels; any two distinct values, mapped internally to -1/+1.
- C
Box constraint, positive.
- kernel
"rbf", "linear", "poly" or "sigmoid".
- gamma
Kernel width for rbf/sigmoid; defaults to
1/p.- degree, coef0
Polynomial and sigmoid kernel parameters.
- newdata
Points to classify; defaults to
X.- tol, max_passes, seed
SMO controls.
Value
List with alpha, b, support (1-based indices), decision,
class, accuracy, and dual_gap_check (which the equality constraint
forces to zero).
