svrfit

Epsilon-Support Vector regression.

Attention: Available only with Twin Activate commercial edition.

Syntax

parameters = svrfit(X,y)

parameters = svrfit(X,y,options)

Inputs

X
Training data.
Type: double
Dimension: vector | matrix
y
Target values.
Type: double
Dimension: vector | matrix
options
Type: struct
kernel
Kernel type to be used in the algorithm. Allowed values are 'linear' (default), 'poly', 'rbf', 'sigmoid'.
Type: char
Dimension: string
degree
Degree of the polynomial kernel function ('poly') (default: 3). This parameter is ignored by other kernels.
Type: integer
Dimension: scalar
gamma
Kernel coefficient for 'rbf', 'poly' and 'sigmoid' kernel. Allowed values are any float. If gamma is not assigned, then 1 / (n_features * variance(X)) is taken as gamma.
Type: char
Dimension: string
coef0
Independent term in kernel function (default: 0). It is only significant in 'poly' and 'sigmoid'.
Type: double
Dimension: scalar
tol
Tolerance of stopping criterion (default: 1e-3).
Type: double
Dimension: scalar
C
Penalty parameter C of the error term (default: 1).
Type: double
Dimension: scalar
epsilon
Epsilon in Epsilon-SVR model (default: 0.1). It specifies the epsilon-tube within which no penalty is associated in the training loss function with points predicted within a distance epsilon from the actual value.
Type: double
Dimension: scalar
shrinking
Whether to use the shrinking heuristic (default: true).
Type: Boolean
Dimension: logical
cache_size
Specify the size of kernel cache (in MB).
Type: double
Dimension: scalar
cache_size
Hard limit on iterations within solver (default: -1, which means no limit).
Type: integer
Dimension: scalar

Outputs

parameters
Contains all the values passed to svrfit method as options. Additionally it has below key-value pairs.
Type: struct
scorer
Function handle pointing to r2 function (R2 Coefficient of Determination).
Type: function handle
n_samples
Number of rows in the training data.
Type: integer
Dimension: scalar
n_features
Number of columns in the training data.
Type: integer
Dimension: scalar
support
Indices of support vectors.
Type: integer
Dimension: vector
support_vectors
Support vectors.
Type: double
Dimension: vector | matrix
dual_coef
Coefficients of the support vector in the decision function.
Type: integer
Dimension: vector
intercept
Constants in decision function.
Type: double
Dimension: scalar
coef
Weights assigned to features (coefficients in primal problem). This is available only if kernel is set to 'linear'. It is derived from dual_coef and support_vectors.
Type: double
Dimension: vector

Example

Usage of svrfit with options

X = [1 2 3; 4 5 6; 7 8 9; 10 11 12; 13 14 15; 16 17 18; 19 20 21];
y = [1, 2, 3, 4, 5, 6, 7];
options = struct;
options.kernel = 'poly';
options.degree = 3;
parameters = svrfit(X, y, options)
parameters = struct [
  C: 1
  coef0: 0
  degree: 3
  dual_coef: [Matrix] 1 x 7 Row[1] Columns[1:5]
  -1.00000 -1.00000 0.18977 1.00000 1.00000 
  Row[1] Columns[6:7]
  0.81023 -1.00000
  epsilon: 0.1
  gamma: scale
  intercept: 2.3423911
  kernel: poly
  max_iter: -1
  model_name: model_16353129739498596
  n_features: 3
  n_samples: 7
  scorer: @r2
  shrinking: 1
  support: [Matrix] 1 x 7
  0 1 2 3 4 5 6
  support_vectors: [Matrix] 7 x 3
  1 2 3
  4 5 6
  7 8 9
  10 11 12
  13 14 15
  16 17 18
  19 20 21
  tol: 0.001
]

Comments

Output 'parameters' can be passed to svrpredict function.