org.encog.neural.networks.training.svm
Class SVMTrain

java.lang.Object
  extended by org.encog.neural.networks.training.BasicTraining
      extended by org.encog.neural.networks.training.svm.SVMTrain
All Implemented Interfaces:
Train

public class SVMTrain
extends BasicTraining

Provides training for Support Vector Machine networks.


Field Summary
static double DEFAULT_CONST_BEGIN
          The default starting number for C.
static double DEFAULT_CONST_END
          The default ending number for C.
static double DEFAULT_CONST_STEP
          The default step for C.
static double DEFAULT_GAMMA_BEGIN
          The default gamma begin.
static double DEFAULT_GAMMA_END
          The default gamma end.
static double DEFAULT_GAMMA_STEP
          The default gamma step.
 
Constructor Summary
SVMTrain(BasicNetwork network, NeuralDataSet training)
          Construct a trainer for an SVM network.
 
Method Summary
 double crossValidate(int index, double gamma, double c)
          Cross validate and check the specified index/gamma.
 void finishTraining()
          Called to finish training.
 double getConstBegin()
           
 double getConstEnd()
           
 double getConstStep()
           
 int getFold()
           
 double getGammaBegin()
           
 double getGammaEnd()
           
 double getGammaStep()
           
 BasicNetwork getNetwork()
          Get the current best network from the training.
 svm_problem[] getProblem()
           
 boolean isTrainingDone()
           
 void iteration()
          Perform one training iteration.
 void setConstBegin(double constBegin)
           
 void setConstEnd(double constEnd)
           
 void setConstStep(double constStep)
           
 void setFold(int fold)
           
 void setGammaBegin(double gammaBegin)
           
 void setGammaEnd(double gammaEnd)
           
 void setGammaStep(double gammaStep)
           
 void train()
          Quickly train all outputs with a C of 1.0 and a gamma equal to 1/(num inputs).
 void train(double gamma, double c)
          Quickly train the network with a fixed gamma and C.
 void train(int index, double gamma, double c)
          Quickly train one output with the specified gamma and C.
 
Methods inherited from class org.encog.neural.networks.training.BasicTraining
addStrategy, getCloud, getError, getIteration, getStrategies, getTraining, iteration, postIteration, preIteration, setCloud, setError, setIteration, setTraining
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONST_BEGIN

public static final double DEFAULT_CONST_BEGIN
The default starting number for C.

See Also:
Constant Field Values

DEFAULT_CONST_END

public static final double DEFAULT_CONST_END
The default ending number for C.

See Also:
Constant Field Values

DEFAULT_CONST_STEP

public static final double DEFAULT_CONST_STEP
The default step for C.

See Also:
Constant Field Values

DEFAULT_GAMMA_BEGIN

public static final double DEFAULT_GAMMA_BEGIN
The default gamma begin.

See Also:
Constant Field Values

DEFAULT_GAMMA_END

public static final double DEFAULT_GAMMA_END
The default gamma end.

See Also:
Constant Field Values

DEFAULT_GAMMA_STEP

public static final double DEFAULT_GAMMA_STEP
The default gamma step.

See Also:
Constant Field Values
Constructor Detail

SVMTrain

public SVMTrain(BasicNetwork network,
                NeuralDataSet training)
Construct a trainer for an SVM network.

Parameters:
network - The network to train.
training - The training data for this network.
Method Detail

train

public void train()
Quickly train all outputs with a C of 1.0 and a gamma equal to 1/(num inputs).


train

public void train(int index,
                  double gamma,
                  double c)
Quickly train one output with the specified gamma and C.

Parameters:
index - The output to train.
gamma - The gamma to train with.
c - The C to train with.

crossValidate

public double crossValidate(int index,
                            double gamma,
                            double c)
Cross validate and check the specified index/gamma.

Parameters:
index - The output index to cross validate.
gamma - The gamma to check.
c - The C to check.
Returns:
The calculated error.

iteration

public void iteration()
Perform one training iteration.


getProblem

public svm_problem[] getProblem()
Returns:
The problem being trained.

getFold

public int getFold()
Returns:
the fold

setFold

public void setFold(int fold)
Parameters:
fold - the fold to set

getConstBegin

public double getConstBegin()
Returns:
the constBegin

setConstBegin

public void setConstBegin(double constBegin)
Parameters:
constBegin - the constBegin to set

getConstStep

public double getConstStep()
Returns:
the constStep

setConstStep

public void setConstStep(double constStep)
Parameters:
constStep - the constStep to set

getConstEnd

public double getConstEnd()
Returns:
the constEnd

setConstEnd

public void setConstEnd(double constEnd)
Parameters:
constEnd - the constEnd to set

getGammaBegin

public double getGammaBegin()
Returns:
the gammaBegin

setGammaBegin

public void setGammaBegin(double gammaBegin)
Parameters:
gammaBegin - the gammaBegin to set

getGammaEnd

public double getGammaEnd()
Returns:
the gammaEnd

setGammaEnd

public void setGammaEnd(double gammaEnd)
Parameters:
gammaEnd - the gammaEnd to set

getGammaStep

public double getGammaStep()
Returns:
the gammaStep

setGammaStep

public void setGammaStep(double gammaStep)
Parameters:
gammaStep - the gammaStep to set

finishTraining

public void finishTraining()
Called to finish training.

Specified by:
finishTraining in interface Train
Overrides:
finishTraining in class BasicTraining

getNetwork

public BasicNetwork getNetwork()
Description copied from interface: Train
Get the current best network from the training.

Returns:
The trained network.

isTrainingDone

public boolean isTrainingDone()
Specified by:
isTrainingDone in interface Train
Overrides:
isTrainingDone in class BasicTraining
Returns:
True if the training is done.

train

public void train(double gamma,
                  double c)
Quickly train the network with a fixed gamma and C.

Parameters:
gamma - The gamma to use.
c - The C to use.


Copyright © 2011. All Rights Reserved.