org.encog.neural.networks.svm
Class SVMNetwork

java.lang.Object
  extended by org.encog.persist.BasicPersistedObject
      extended by org.encog.neural.networks.BasicNetwork
          extended by org.encog.neural.networks.svm.SVMNetwork
All Implemented Interfaces:
Serializable, EngineMachineLearning, ContextClearable, Network, EncogPersistedObject

public class SVMNetwork
extends BasicNetwork

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

Field Summary
 
Fields inherited from class org.encog.neural.networks.BasicNetwork
DEFAULT_CONNECTION_LIMIT, TAG_INPUT, TAG_LIMIT, TAG_OUTPUT
 
Constructor Summary
SVMNetwork(int inputCount, int outputCount, boolean regression)
          Construct an SVM network.
SVMNetwork(int inputCount, int outputCount, SVMType svmType, KernelType kernelType)
          Construct a SVM network.
 
Method Summary
 NeuralData compute(NeuralData input)
          Compute the output for the given input.
 NeuralData compute(NeuralData input, NeuralOutputHolder useHolder)
          Compute the output for the given input.
 Persistor createPersistor()
          Create a persistor for this object.
 int getInputCount()
          
 KernelType getKernelType()
           
 svm_model[] getModels()
           
 int getOutputCount()
          
 svm_parameter[] getParams()
           
 SVMType getSvmType()
           
 svm_node[] makeSparse(NeuralData data)
          Convert regular Encog NeuralData into the "sparse" data needed by an SVM.
 
Methods inherited from class org.encog.neural.networks.BasicNetwork
addLayer, addLayer, calculateError, calculateNeuronCount, clearContext, clearLayerTags, clone, compute, determineWinner, dumpWeights, enableConnection, equals, equals, getLayer, getLayerTags, getLogic, getProperties, getPropertyDouble, getPropertyLong, getPropertyString, getStructure, getTags, getWeightMatrixSize, hashCode, isConnected, reset, setBiasActivation, setLogic, setProperty, setProperty, setProperty, tagLayer, toString, winner
 
Methods inherited from class org.encog.persist.BasicPersistedObject
getCollection, getDescription, getName, setCollection, setDescription, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.encog.neural.networks.Network
getDescription, getName, setDescription, setName
 
Methods inherited from interface org.encog.persist.EncogPersistedObject
getCollection, setCollection
 

Constructor Detail

SVMNetwork

public SVMNetwork(int inputCount,
                  int outputCount,
                  SVMType svmType,
                  KernelType kernelType)
Construct a SVM network.

Parameters:
inputCount - The input count.
outputCount - The output count.
svmType - The type of SVM.
kernelType - The SVM kernal type.

SVMNetwork

public SVMNetwork(int inputCount,
                  int outputCount,
                  boolean regression)
Construct an SVM network. For regression it will use an epsilon support vector. Both types will use an RBF kernel.

Parameters:
inputCount - The input count.
outputCount - The output count.
regression - True if this network is used for regression.
Method Detail

compute

public NeuralData compute(NeuralData input)
Compute the output for the given input.

Specified by:
compute in interface Network
Overrides:
compute in class BasicNetwork
Parameters:
input - The input to the SVM.
Returns:
The results from the SVM.

compute

public NeuralData compute(NeuralData input,
                          NeuralOutputHolder useHolder)
Compute the output for the given input.

Specified by:
compute in interface Network
Overrides:
compute in class BasicNetwork
Parameters:
input - The input to the SVM.
useHolder - The output holder to use.
Returns:
The results from the SVM.

makeSparse

public svm_node[] makeSparse(NeuralData data)
Convert regular Encog NeuralData into the "sparse" data needed by an SVM.

Parameters:
data - The data to convert.
Returns:
The SVM sparse data.

createPersistor

public Persistor createPersistor()
Create a persistor for this object.

Specified by:
createPersistor in interface Network
Specified by:
createPersistor in interface EncogPersistedObject
Overrides:
createPersistor in class BasicNetwork
Returns:
The newly created persistor.

getInputCount

public int getInputCount()
Description copied from class: BasicNetwork

Specified by:
getInputCount in interface EngineMachineLearning
Overrides:
getInputCount in class BasicNetwork
Returns:
The input count.

getOutputCount

public int getOutputCount()
Description copied from class: BasicNetwork

Specified by:
getOutputCount in interface EngineMachineLearning
Overrides:
getOutputCount in class BasicNetwork
Returns:
The output count.

getModels

public svm_model[] getModels()
Returns:
The SVM models for each output.

getParams

public svm_parameter[] getParams()
Returns:
The SVM params for each of the outputs.

getKernelType

public KernelType getKernelType()
Returns:
The SVM kernel type.

getSvmType

public SVMType getSvmType()
Returns:
The type of SVM in use.


Copyright © 2011. All Rights Reserved.