Learn R Programming

daltoolboxdp (version 1.2.737)

skcla_svc: Support Vector Machine Classification

Description

Implements classification using support vector machines. Wraps scikit-learn's SVC through reticulate.

Usage

skcla_svc(
  attribute,
  slevels,
  kernel = "rbf",
  degree = 3,
  gamma = "scale",
  coef0 = 0,
  tol = 0.001,
  C = 1,
  shrinking = TRUE,
  probability = FALSE,
  cache_size = 200,
  class_weight = NULL,
  verbose = FALSE,
  max_iter = -1,
  decision_function_shape = "ovr",
  break_ties = FALSE,
  random_state = NULL
)

Value

A skcla_svc classifier object.

Arguments

attribute

Target attribute name for model building

slevels

List of possible values for classification target

kernel

Kernel function type ('linear', 'poly', 'rbf', 'sigmoid')

degree

Polynomial degree when using 'poly' kernel

gamma

Kernel coefficient value

coef0

Independent term value in kernel function

tol

Tolerance value for stopping criterion

C

Regularization strength parameter

shrinking

Whether to use shrinking heuristic

probability

Whether to enable probability estimates

cache_size

Kernel cache size value in MB

class_weight

Weights associated with classes

verbose

Whether to enable verbose output

max_iter

Maximum number of iterations

decision_function_shape

Shape of decision function ('ovo', 'ovr')

break_ties

Whether to break tie decisions

random_state

Seed for random number generation

Details

SVM Classifier

References

Cortes, C., & Vapnik, V. (1995). Support-Vector Networks.

Examples

Run this code
if (FALSE) {
data(iris)

# 1) Create SVM classifier (RBF kernel)
clf <- skcla_svc(attribute = 'Species', slevels = levels(iris$Species), kernel = 'rbf', C = 1)

# 2) Fit and predict
clf <- daltoolbox::fit(clf, iris)
pred <- predict(clf, iris)
table(pred, iris$Species)
}

# More examples:
# https://github.com/cefet-rj-dal/daltoolboxdp/blob/main/examples/cla_svm.md

Run the code above in your browser using DataLab