SVM
org.encog.ml.svm

Class SVM

  • All Implemented Interfaces:
    Serializable, MLClassification, MLError, MLInput, MLInputOutput, MLMethod, MLOutput, MLProperties, MLRegression


    public class SVMextends BasicMLimplements MLRegression, MLClassification, MLError
    This is a network that is backed by one or more Support Vector Machines (SVM). It is designed to function very similarly to an Encog neural network, and is largely interchangeable with an Encog neural network. The support vector machine supports several types. Regression is used when you want the network to predict a value, given the input. Function approximation is a good example of regression. Classification is used when you want the SVM to group the input data into one or more classes. Support Vector Machines typically have a single output. Neural networks can have multiple output neurons. To get around this issue, this class will create multiple SVM's if there is more than one output specified. Because a SVM is trained quite differently from a neural network, none of the neural network training classes will work. This class must be trained using SVMTrain.
    See Also:
    Serialized Form
    • Constructor Detail

      • SVM

        public SVM()
        Construct the SVM.
      • SVM

        public SVM(int theInputCount,   boolean regression)
        Construct an SVM network. For regression it will use an epsilon support vector. Both types will use an RBF kernel.
        Parameters:
        theInputCount - The input count.
        regression - True if this network is used for regression.
      • SVM

        public SVM(int theInputCount,   SVMType svmType,   KernelType kernelType)
        Construct a SVM network.
        Parameters:
        theInputCount - The input count.
        svmType - The type of SVM.
        kernelType - The SVM kernal type.
      • SVM

        public SVM(svm_model theModel)
        Construct a SVM from a model.
        Parameters:
        theModel - The model.
    • Method Detail

      • calculateError

        public final double calculateError(MLDataSet data)
        Calculate the error for this SVM.
        Specified by:
        calculateError in interface MLError
        Parameters:
        data - The training set.
        Returns:
        The error percentage.
      • classify

        public final int classify(MLData input)
        Classify the input into a group.
        Specified by:
        classify in interface MLClassification
        Parameters:
        input - The input data to classify.
        Returns:
        The group that the data was classified into.
      • compute

        public final MLData compute(MLData input)
        Compute the output for the given input.
        Specified by:
        compute in interface MLRegression
        Parameters:
        input - The input to the SVM.
        Returns:
        The results from the SVM.
      • getInputCount

        public final int getInputCount()
        Specified by:
        getInputCount in interface MLInput
        Returns:
        The input count.
      • getKernelType

        public final KernelType getKernelType()
        Returns:
        The kernel type.
      • getModel

        public final svm_model getModel()
        Returns:
        The SVM models for each output.
      • getOutputCount

        public final int getOutputCount()
        Specified by:
        getOutputCount in interface MLOutput
        Returns:
        For a SVM, the output count is always one.
      • getParams

        public final svm_parameter getParams()
        Returns:
        The SVM params for each of the outputs.
      • getSVMType

        public final SVMType getSVMType()
        Returns:
        The SVM type.
      • makeSparse

        public final svm_node[] makeSparse(MLData data)
        Convert regular Encog MLData into the "sparse" data needed by an SVM.
        Parameters:
        data - The data to convert.
        Returns:
        The SVM sparse data.
      • setInputCount

        public final void setInputCount(int i)
        Set the input count.
        Parameters:
        i - The new input count.
      • setModel

        public final void setModel(svm_model theModel)
        Set the model.
        Parameters:
        theModel - The model.

SCaVis 2.1 © jWork.ORG