supportVectorClassification¶
Classifies unknown patterns using a previously trained Support Vector Machines (SVM) model computed by supportVectorTrainer.
Synopsis¶
supportVectorClassification ( svmClassifier, x)
Required Arguments¶
- Imsls_f_ svm_model
svmClassifier
(Input) - A Imsls_d_svm_model from
supportVectorTrainer
. - float
x[[]]
(Input) - An array of length
nPatterns
bynAttributes
containing the data matrix wherenAttributes
is the number of attributes as specified insupportVectorTrainer
.
Return Value¶
An array of length nPatterns
containing the predicted classification
associated with each input pattern for a classification model, or the
calculated function value for a regression model. If classification is
unsuccessful, None
is returned.
Optional Arguments¶
svmKernelPrecomputed
, float[]
(Input)- An array of length
nPatterns
bynPatterns
containing the precomputed kernel function values. Assume there are L testing instances \(x_1,x_2,\ldots,x_L\) and let \(K(x,y)\) be the kernel function value of two instances x and y. Row i of the testing or training data set would be represented by \(K(x_i,x_1) K(x_i,x_2) \ldots K(x_i,x_L)\). All kernel function values, including zeros, must be provided.Use of this argument indicates that the kernel function values have been precomputed for the training and testing data sets. IfsvmKernelPrecomputed
is used, the required argumentx
is ignored. predictedClassProb
(Output)An array of length
nPatterns
bynClasses
, wherenClasses
is the number of target classifications. The values in the i-th row are the predicted classification probabilities associated with the target classes.predictedClassProb[inClasses+j]
is the estimated probability that the i-th pattern belongs to the j-th target class.For regression and one-class SVMs, the array
predictedClassProb
isNone
.svrProbability
(Output)For a regression model with probability information, this option outputs a value σ > 0. For the test data, we consider the probability model as
target value = predicted value + z
where z is distributed according to Laplace with zero-mean density function \(p(x)=e^{-|x|/\sigma}/2\sigma\).
svrProbability
contains σ on output. If the model is not for SVR or does not contain the required probability information, 0 is returned.classError
, floatpClassification[]
, intclassErrors
(Output)- Returns classification error counts.
- float
pClassification[]
(Input) - An array of length
nPatterns
containing the known classifications for each of the patterns. - int
classErrors
(Output) - An array of length
(nClasses+1)
by2
containing the number of classification errors and the number of non-missing classifications for each target classification, plus the overall totals for these errors. For i <nClasses
, the i-th row contains the number of classification errors for the i-th class and the number of patterns with non-missing classifications for that class. The last row contains the number of classification errors totaled over all target classifications, and the total number of patterns with non-missing target classifications. To release this space, use free. decisionValues
,i
,decValues
(Output)Gives decision values on row i of data matrix
x
. The decision values are used to predict the target classification value. For binary class problems, decision values are signed values used to determine which side of the decision boundary the observation in question lays. Recall that SVM combines multiple binary classifiers for multi-class classification. The magnitudes of the decision values are essentially meaningless as only the sign is used to determine whether the point is more likely to belong to class[i] versus class[j] (a positive value) or less likely to belong to class[i] versus class[j] (a negative value). See the Description section for more on how the decision values are used to predict the target classification value.For a classification model with nClasses classes, this function gives nClasses(nClasses-1)/2 decision values in the array
decValues
. The order is class[0] vs. class[1], …, class[0] vs. class[nClasses-1], class[1] vs. class[2], …, class[1] vs. class[nClasses-1], …, class[nClasses-2] vs. class[nClasses-1], where class contains the target classification values.For a regression model, only 1 value is returned.
decValues[0]
is the function value of row i of x calculated using the model. For a one-class model,decValues[0]
is the decision value of row i ofx
. To release this space, use free
Description¶
Function supportVectorClassification
estimates classification
probabilities from a previously trained SVM model. This function does
classification or regression on a test vector x using the SVM model output
from supportVectorTrainer
. For a classification model, the predicted
class for x is returned. For a regression model, the function value of x
calculated using the model is returned. For a one-class model, +1 or -1 is
returned signifying that the observation belongs to (+1) or does not belong
to (‑1) the expected class. The predicted classification returned by this
function is the class with the largest estimated classification probability.
The classification probability estimates for each pattern can be obtained
using the optional argument predictedClassProb
.
The decision values which are returned through the use of optional argument
decisionValues
are used to cast votes for the target classification
value. Only the sign of the decision value is used in casting votes. For a
decision value for class[i] versus class[j], a positive value is
interpreted as class[i] being more likely than class[j], so class[i]
would get a vote. A negative value is interpreted as class[i] being less
likely than class[j], so class[j] would get a vote. The votes along a
row of decision values are tallied to elect the class with the most votes as
the target classification value. In case of a tie, the first class
encountered with the highest number of votes in a row of decision values is
the predicted class for that row.
Function supportVectorClassification
is based on LIBSVM, Copyright (c)
2000-2013, with permission from the authors, Chih-Chung Chang and Chih-Jen
Lin with the following disclaimer:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS’’ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Warning Errors¶
IMSLS_INADEQUATE_MODEL |
The model used contains inadequate information to compute the requested probability. |