Skip to content

Support Vector Machine

dvarkless edited this page Sep 3, 2023 · 1 revision

SVM_Model

The model of a support vector machine for multiclass classification. It builds a hyperplane with the maximum distance from points in space, dividing the input data into 2 classes.

To classify into 3 or more classes, you need to build several models and compare their results in the way of 'one against one' or 'one against the rest' (One vs One, One vs Rest). At the moment, the One vs Rest method is implemented

The Soft Margin Loss cost function is applied: https://towardsdatascience.com/svm-implementation-from-scratch-python-2db2fc52e5c2#66a2

For the cost function to work, you need answers on a training sample serve in the form of: [-1, -1, 1, -1], where the unit position is the point class number.

Parameters:

data_converter - function-converter for input data
shift_column: bool - use a column of constants to act as additive for folmula: wx_1 + wx_2 .... + wx_n + b = Y
normalization: bool - use normalization for input values
num_classes: int - number of classes in dataset
learning_rate: float - how fast model will fit
batch_size: int - size of mini-datasets to process while fitting. helps avoid overfitting
epochs: int - count of gradient descent steps for whole dataset
regularization: float - regularization strength for loss function

Clone this wiki locally