The IDLmlSupportVectorMachineRegression class implements an SVM model that can be used for regression purposes.

Example


; Generate some data to regress.
n = 40
x = findgen(n) / (n-1) * 6 - 3
y = fltarr(n) + 1.0
xx = x # y
yy = transpose(xx)
zz = (yy^2 - xx^2)
orig_data = transpose([[reform(xx, xx.length)], [reform(yy, yy.length)]])
 
; Make a copy that we can shuffle.
data = orig_data
scores = reform(zz, zz.length)
nExamples = scores.length
nAttributes = 2
IDLmlShuffle, data, scores
part = IDLmlPartition({train:20, test:80}, data, scores)
oModel = IDLmlSupportVectorMachineRegression(nAttributes)
loss = oModel.Train(part.train.data, SCORES=part.train.scores)
 
; Now evaluate the entire dataset.
results = oModel.Evaluate(orig_data)
 
results_2d = Reform(results, n, n)
!null = Surface(zz, color=[255,255,0], layout=[2,1,1], $
  title='Original Data', window_title='SVM Regression', dimensions=[1100,500])
!null = Surface(results_2d, color=[0,255,0], layout=[2,1,1], /overplot)
!null = Surface(results_2d, color=[0,255,0],layout=[2,1,2], $
  title='Regression Result', /current)

Syntax


Result = IDLmlSupportVectorMachineRegression(Nattributes [, Keywords=Value])

Arguments


Nattributes

Specify the number of attributes that the input data will be required to have.

Keywords


KERNEL (optional)

Set this keyword to a valid kernel object (IDLmlSVM*Kernel) that encapsulates several SVM parameters. Valid options include IDLmlSVMLinearKernel, IDLmlSVMPolynomialKernel, IDLmlSVMRadialKernel (default), and IDLmlSVMSigmoidKernel.

PENALTY (optional)

Set this keyword to a value indicating the penalty parameter. The default value is 100.0. The optimal value for any particular model is highly variable and will most likely need to be adjusted. You should perform a grid search for parameter selection as described in Hsu, Chang, and Lin (2010).

References

Chih-Chung Chang and Chih-Jen Lin, LIBSVM: a library for support vector machines. ACM Transactions on Intelligent Systems and Technology, 2:27:1--27:27, 2011. Software available at http://www.csie.ntu.edu.tw/~cjlin/libsvm.

Hsu, C.-W., C.-C. Chang, and C.-J. Lin. (2010). A practical guide to support vector classification. National Taiwan University. http://ntu.csie.org/~cjlin/papers/guide/guide.pdf.

Wu, T.-F., C.-J. Lin, and R. C. Weng. (2004). Probability estimates for multi-class classification by pairwise coupling. Journal of Machine Learning Research, 5:975-1005, http://www.csie.ntu.edu.tw/~cjlin/papers/svmprob/svmprob.pdf.

PROBABILITY (optional)

Set this keyword to train the model for probability estimates. The default is 0 for regression problems.

SHRINK (optional)

Set this keyword to ask the model to use the shrinking heuristics. The default is 1.

Properties


KERNEL

The kernel object used to define the model.

NATTRIBUTES

The number of input attributes the model requires.

NOUTPUTS

The number of possible outputs. For this type of model, this value will always be 1.

PENALTY

The penalty parameter used in the model.

Methods


IDLmlSupportVectorMachineRegression::Evaluate


The IDLmlSupportVectorMachineRegression::Evaluate method evaluates a number of features and returns an array of scores that represent how closely each feature matches each output.

Syntax


Result = Obj->[IDLmlSupportVectorMachineRegression::]Evaluate(Features [, Keywords=Value])

Return Value


This method returns the scores associated with the features. Scores represent the actual numerical outputs obtained by the model in response to a number of inputs.

Arguments


Features

Specify an array of features of size n x m, where n is the number of attributes and m is the number of examples.

Keywords


LOSS (optional)

Set this keyword to a variable that will contain the loss result, which is a unitless number that indicates how closely the model fits the training data.

SCORES (optional)

Set this keyword to an array of size m, where m is the number of examples containing the actual scores associated with the features. Use this keyword to pass in the actual scores associated with the features if you want to calculate the loss.

IDLmlSupportVectorMachineRegression::Restore


The IDLmlSupportVectorMachineRegression::Restore static method restores the model from a file.

Syntax


Result = IDLmlSupportVectorMachineRegression.Restore(Filename)

Return Value


A reference to the object instance restored from the file.

Arguments


Filename

Specify the name of the file to restore.

Keywords


None

IDLmlSupportVectorMachineRegression::Save


The IDLmlSupportVectorMachineRegression::Save method saves the model to a file.

Syntax


Obj->[IDLmlSupportVectorMachineRegression::]Save, Filename

Arguments


Filename

Specify the name of the file to save.

Keywords


None

IDLmlSupportVectorMachineRegression::Train


The IDLmlSupportVectorMachineRegression::Train method performs training on the model and the loss, which is a unitless number that indicates how closely the model fits the training data. Unlike all other models, IDLmlSupportVectorMachineRegression only needs to be trained once. Calling this method multiple times will not result in a better trained model.

Syntax


Result = Obj->[IDLmlSupportVectorMachineRegression::]Train(Features [, Keywords=Value])

Return Value


This method returns the loss, which is a unitless number that indicates how closely the model fits the training data.

Arguments


Features

Specify an array of features of size n x m, where n is the number of attributes and m is the number of examples.

Keywords


CALLBACK_FUNCTION (optional)

An optional string with the name of an IDL function to be called on each training iteration. The callback function must accept two arguments: loss and state. The callback function must return 1 (!true) if the training should perform another iteration, or 0 (!false) if it should stop training.

SCORES (optional)

An array of size m, where m is the number of examples containing the actual scores associated with the features.

TRAIN_STATE (optional)

Specify optional user data to provide for the callback function.

Version History


8.7.1

Introduced

See Also


IDLmlAutoEncoder, IDLmlFeedForwardNeuralNetwork, IDLmlKMeans, IDLmlSoftmax, IDLmlSupportVectorMachineClassification