cv.SVMSGD - MATLAB File Help | Go to online doc for cv.SVMSGD |
Stochastic Gradient Descent SVM classifier
SVMSGD provides a fast and easy-to-use implementation of the SVM classifier using the Stochastic Gradient Descent approach, as presented in [bottou2010large].
The classifier has following parameters:
lambda
),gamma_0
),c
),The model type may have one of the following values: 'SGD' and 'ASGD'.
SGD is the classic version of SVMSGD classifier: every next step is calculated by the formula:
w_{t+1} = w_t - gamma(t) * (dQ_i/dw)|_{w = w_t}
where
w_t
is the weights vector for decision function at step t
,gamma(t)
is the step size of model parameters at the iteration
t
, it is decreased on each step by the formula
gamma(t) = gamma_0 * (1 + lambda*gamma_0*t)^(-c)
Q_i
is the target functional from SVM task for sample with
number i
, this sample is chosen stochastically on each step of
the algorithm.ASGD is Average Stochastic Gradient Descent SVM Classifier. ASGD
classifier averages weights vector on each step of algorithm by the
formula wHat_{t+1} = t/(1+t) * wHat_t + 1/(1+t) * w_{t+1}
.
The recommended model type is ASGD (following [bottou2010large]).
The margin type may have one of the following values:
In the general case (if you know nothing about linear separability of your sets), use 'SoftMargin'.
The other parameters may be described as follows:
gamma(t)
. You will have to find the best initial step for your
problem.gamma(t)
decreasing
by the formula, mentioned above. Recommended value for SGD model is 1,
for ASGD model is 0.75.Note that the parameters margin regularization, initial step size, and step decreasing power should be positive.
To use SVMSGD algorithm do as follows:
Example:
% Create empty object
svmsgd = cv.SVMSGD();
% Train the Stochastic Gradient Descent SVM
svmsgd.train(trainData);
% Predict labels for the new samples
svmsgd.predict(samples, responses);
[bottou2010large]:
Leon Bottou. "Large-scale machine learning with stochastic gradient descent". In Proceedings of COMPSTAT 2010, pages 177-186. Springer.
Superclasses | handle |
Sealed | false |
Construct on load | false |
SVMSGD | Creates empty model |
InitialStepSize | Parameter initial step size of a SVMSGD optimization problem. |
MarginRegularization | Parameter margin regularization of a SVMSGD optimization problem. |
MarginType | Margin type. |
StepDecreasingPower | Parameter step decreasing power of a SVMSGD optimization problem. |
SvmsgdType | Algorithm type. |
TermCriteria | Termination criteria of the training algorithm. |
id | Object ID |
addlistener | Add listener for event. | |
calcError | Computes error on the training or test dataset | |
clear | Clears the algorithm state | |
delete | Destructor | |
empty | Returns true if the algorithm is empty | |
eq | == (EQ) Test handle equality. | |
findobj | Find objects matching specified conditions. | |
findprop | Find property of MATLAB handle object. | |
ge | >= (GE) Greater than or equal relation for handles. | |
getDefaultName | Returns the algorithm string identifier | |
getShift | Get model shift | |
getVarCount | Returns the number of variables in training samples | |
getWeights | Get model weights | |
gt | > (GT) Greater than relation for handles. | |
isClassifier | Returns true if the model is a classifier | |
isTrained | Returns true if the model is trained | |
Sealed | isvalid | Test handle validity. |
le | <= (LE) Less than or equal relation for handles. | |
listener | Add listener for event without binding the listener to the source object. | |
load | Loads algorithm from a file or a string | |
lt | < (LT) Less than relation for handles. | |
ne | ~= (NE) Not equal relation for handles. | |
notify | Notify listeners of event. | |
predict | Predicts response(s) for the provided sample(s) | |
save | Saves the algorithm parameters to a file or a string | |
setOptimalParameters | Function sets optimal parameters values for chosen SVM SGD model | |
train | Trains the statistical model |
ObjectBeingDestroyed | Notifies listeners that a particular object has been destroyed. |