Support Vector Machine

LinearKernel

A linear kernel.

This function has the following formula:

\[K(\boldsymbol{x}, \boldsymbol{x'}) = \boldsymbol{x}^T \boldsymbol{x'}\]
message LinearKernel {
}

RBFKernel

A Gaussian radial basis function (RBF) kernel.

This function has the following formula:

\[K(\boldsymbol{x}, \boldsymbol{x'}) = \ \exp(-\gamma || \boldsymbol{x} - \boldsymbol{x'} ||^2 )\]
message RBFKernel {
    double gamma = 1;
}

PolyKernel

A polynomial kernel.

This function has the following formula:

\[K(\boldsymbol{x}, \boldsymbol{x'}) = \ (\gamma \boldsymbol{x}^T \boldsymbol{x'} + c)^{degree}\]
message PolyKernel {
    int32 degree = 1;
    double c = 2;
    double gamma = 3;
}

SigmoidKernel

A sigmoid kernel.

This function has the following formula:

\[K(\boldsymbol{x}, \boldsymbol{x'}) = \ \tanh(\gamma \boldsymbol{x}^T \boldsymbol{x'} + c)\]
message SigmoidKernel {
    double gamma = 1;
    double c = 2;
}

Kernel

A kernel.

message Kernel {
    oneof kernel {
        LinearKernel linearKernel = 1;
        RBFKernel rbfKernel = 2;
        PolyKernel polyKernel = 3;
        SigmoidKernel sigmoidKernel = 4;
    }
}

SparseNode

A sparse node.

message SparseNode {
    int32 index = 1; // 1-based indexes, like libsvm
    double value = 2;
}

SparseVector

A sparse vector.

message SparseVector {
    repeated SparseNode nodes = 1;
}

SparseSupportVectors

One or more sparse support vectors.

message SparseSupportVectors {
    repeated SparseVector vectors = 1;
}

DenseVector

A dense vector.

message DenseVector {
    repeated double values = 1;
}

DenseSupportVectors

One or more dense support vectors.

message DenseSupportVectors {
    repeated DenseVector vectors = 1;
}

Coefficients

One or more coefficients.

message Coefficients {
    repeated double alpha = 1;
}

SupportVectorRegressor

A support vector regressor.

message SupportVectorRegressor {
    Kernel kernel = 1;

    // Support vectors, either sparse or dense format
    oneof supportVectors {
        SparseSupportVectors sparseSupportVectors = 2;
        DenseSupportVectors denseSupportVectors = 3;
    }

    // Coefficients, one for each support vector
    Coefficients coefficients = 4;

    double rho = 5;
}

SupportVectorClassifier

A support vector classifier

message SupportVectorClassifier {
    Kernel kernel = 1;

    repeated int32 numberOfSupportVectorsPerClass = 2;

    oneof supportVectors {
        SparseSupportVectors sparseSupportVectors = 3;
        DenseSupportVectors denseSupportVectors = 4;
    }

    repeated Coefficients coefficients = 5;

    repeated double rho = 6;

    repeated double probA = 7;
    repeated double probB = 8;

    oneof ClassLabels {
        StringVector stringClassLabels = 100;
        Int64Vector int64ClassLabels = 101;
    }
}