nuget server logo nuget api documents
↑

API Docs / Microsoft.VisualBasic.MachineLearning / Procedures

Procedures

Full name Microsoft.VisualBasic.MachineLearning.SVM.Procedures Assembly Microsoft.VisualBasic.MachineLearning Members 21

01 Syntax

Microsoft.VisualBasic.MachineLearning.SVM.Procedures

02 Methods

NameOverloadsSummary
setRandomSeed 1 Set the random seed value which is used by the LibSVM procedure.
sigmoid_train 1 Platt's binary SVM Probablistic Output: an improvement from Lin et al.
multiclass_probability 1 Method 2 from the multiclass_prob paper by Wu, Lin, and Weng
svm_binary_svc_probability 1 Cross-validation decision values for probability estimates
svm_svr_probability 1 Return parameter of a Laplace distribution
svm_group_classes 1 group training data of the same class
oneClassSvm 1 regression or one-class-svm
multipleClassification 1 classification
svm_train 1 Train a support vector machine model from the given problem and parameters, this is the entry point of the whole training procedure.
svm_cross_validation 1 Stratified cross validation
svm_get_svm_type 1 Gets the svm type of the given model.
svm_get_nr_class 1 Gets the number of the classes of the given model.
svm_get_labels 1 Copy the class label values of the given model into the target array.
svm_get_sv_indices 1 Copy the indices of the support vectors into the target array.
svm_get_nr_sv 1 Gets the number of the support vectors of the given model.
svm_get_svr_probability 1 Gets the sigma value of the laplace distribution which was estimated for the support vector regression model.
svm_predict_values 1 Evaluate the decision function values of the given input sample.
svm_predict 1 Predict the label or the target value of a single input sample.
svm_predict_probability 1 Evaluate the class probability distribution of the given input sample.
svm_check_parameter 1 Validate the training parameters against the given problem before the training procedure starts.
svm_check_probability_model 1 Check whether the given model contains the information which is required by the probability inference.

03 Members

method setRandomSeed #
setRandomSeed(Int32)

Set the random seed value which is used by the LibSVM procedure.

Parameters
NameTypeDescription
seedInt32

The random seed value.

method sigmoid_train #
sigmoid_train(Int32, Double(), ColorClass(), Double())

Platt's binary SVM Probablistic Output: an improvement from Lin et al.

Parameters
NameTypeDescription
lInt32

The number of the decision values.

dec_valuesDouble()

The decision value of each training sample.

labelsColorClass()

The class label of each training sample.

probABDouble()

The output array which will receive the two parameters A and B of the sigmoid function, its length should be 2 or more.

method multiclass_probability #
multiclass_probability(Int32, Double[0:,0:], Double())

Method 2 from the multiclass_prob paper by Wu, Lin, and Weng

Parameters
NameTypeDescription
kInt32

The number of the classes.

rDouble[0:,0:]

The pairwise probability matrix, in which the element (i, j) is the probability of the class i against the class j.

pDouble()

The output array which will receive the probability value of each class.

method svm_binary_svc_probability #
svm_binary_svc_probability(Problem, Parameter, Double, Double, Double())

Cross-validation decision values for probability estimates

Parameters
NameTypeDescription
probProblem

The training data of the binary sub-problem.

paramParameter

The training parameters.

CpDouble

The C value of the positive side samples.

CnDouble

The C value of the negative side samples.

probABDouble()

The output array which will receive the two parameters A and B of the sigmoid function, its length should be 2 or more.

method svm_svr_probability #
svm_svr_probability(Problem, Parameter)

Return parameter of a Laplace distribution

Parameters
NameTypeDescription
probProblem

The training data of the regression problem.

paramParameter

The training parameters.

Returns

The sigma value of the estimated Laplace distribution; a large value is returned when the regression result is not reliable.

method svm_group_classes #
svm_group_classes(Problem, Int32, Int32(), Int32(), Int32(), Int32())

group training data of the same class

Parameters
NameTypeDescription
probProblem

The source training data which will be grouped.

nr_class_retInt32

The output number of the classes.

label_retInt32()

label name

start_retInt32()

begin of each class

count_retInt32()

#data of classes

permInt32()

indices to the original data, perm, length l, must be allocated before calling this subroutine

method oneClassSvm #
oneClassSvm(Model, Problem, Parameter)

regression or one-class-svm

Parameters
NameTypeDescription
modelModel

The model object which will be filled with the training result.

probProblem

The training data of the one-class or the regression problem.

paramParameter

The training parameters.

method multipleClassification #
multipleClassification(Model, Problem, Parameter)

classification

Parameters
NameTypeDescription
modelModel

The model object which will be filled with the training result.

probProblem

The training data of the multi-class classification problem.

paramParameter

The training parameters.

method svm_train #
svm_train(Problem, Parameter)

Train a support vector machine model from the given problem and parameters, this is the entry point of the whole training procedure.

Parameters
NameTypeDescription
probProblem

The training data.

paramParameter

The training parameters.

Returns

A trained Model object.

method svm_cross_validation #
svm_cross_validation(Problem, Parameter, Int32, SVMPrediction())

Stratified cross validation

Parameters
NameTypeDescription
probProblem

The training data which will be cross validated.

paramParameter

The training parameters.

nr_foldInt32

The number of the folds of the cross validation.

targetSVMPrediction()

The output array which will receive the prediction result of each sample.

method svm_get_svm_type #
svm_get_svm_type(Model)

Gets the svm type of the given model.

Parameters
NameTypeDescription
modelModel

The target model.

Returns

A SvmType value.

method svm_get_nr_class #
svm_get_nr_class(Model)

Gets the number of the classes of the given model.

Parameters
NameTypeDescription
modelModel

The target model.

Returns

An Int32 value.

method svm_get_labels #
svm_get_labels(Model, Int32())

Copy the class label values of the given model into the target array.

Parameters
NameTypeDescription
modelModel

The target model.

labelInt32()

The output array which will receive the class labels, its length should be equals to Model.numberOfClasses.

method svm_get_sv_indices #
svm_get_sv_indices(Model, Int32())

Copy the indices of the support vectors into the target array.

Parameters
NameTypeDescription
modelModel

The target model.

indicesInt32()

The output array which will receive the support vector indices, its length should be equals to Model.supportVectorCount.

method svm_get_nr_sv #
svm_get_nr_sv(Model)

Gets the number of the support vectors of the given model.

Parameters
NameTypeDescription
modelModel

The target model.

Returns

An Int32 value.

method svm_get_svr_probability #
svm_get_svr_probability(Model)

Gets the sigma value of the laplace distribution which was estimated for the support vector regression model.

Parameters
NameTypeDescription
modelModel

The target model.

Returns

The sigma value; a message will be written to the error console and 0 will be returned when the target model does not contain the information for the SVR probability inference.

method svm_predict_values #
svm_predict_values(Model, Node(), Double())

Evaluate the decision function values of the given input sample.

Parameters
NameTypeDescription
modelModel

The target model.

xNode()

The sparse feature vector of the input sample.

dec_valuesDouble()

The output array which will receive the pairwise decision values; for the one-class and the regression models its length should be 1, otherwise it should be nr_class * (nr_class - 1) / 2.

Returns

The SVMPrediction result of the given sample.

method svm_predict #
svm_predict(Model, Node())

Predict the label or the target value of a single input sample.

Parameters
NameTypeDescription
modelModel

The target model.

xNode()

The sparse feature vector of the input sample.

Returns

兼容分类以及打分这两种工作模式

method svm_predict_probability #
svm_predict_probability(Model, Node(), Double())

Evaluate the class probability distribution of the given input sample.

Parameters
NameTypeDescription
modelModel

The target model, it should be trained with the probability estimation enabled.

xNode()

The sparse feature vector of the input sample.

prob_estimatesDouble()

The output array which will receive the probability value of each class, its length should be equals to Model.numberOfClasses.

Returns

The SVMPrediction result of the given sample; when the model does not provide the pairwise probability, this function falls back to the Procedures.svm_predict() function.

method svm_check_parameter #
svm_check_parameter(Problem, Parameter)

Validate the training parameters against the given problem before the training procedure starts.

Parameters
NameTypeDescription
probProblem

The training data.

paramParameter

The training parameters that will be validated.

Returns

An error message which describes the first invalid parameter, or Nothing when all of the parameters are valid.

method svm_check_probability_model #
svm_check_probability_model(Model)

Check whether the given model contains the information which is required by the probability inference.

Parameters
NameTypeDescription
modelModel

The target model.

Returns

1 when the probability information is available, otherwise 0.