com.sjm.machlearn.classifiers.neuralnets
Class BPNeuralNet

java.lang.Object
  |
  +--com.sjm.machlearn.util.MainClass
        |
        +--com.sjm.machlearn.classifiers.Classifier
              |
              +--com.sjm.machlearn.classifiers.neuralnets.BPNeuralNet

public class BPNeuralNet
extends Classifier


Field Summary
protected  BPFeatureVector feature_converter
           
protected  double learn_rate
           
protected  int nhidden
           
protected  int ninputs
           
protected  int noutputs
           
protected  int trainepoch
           
protected  DoubleMatrix whidden
           
protected  DoubleMatrix woutput
           
 
Fields inherited from class com.sjm.machlearn.classifiers.Classifier
Fold10Validation, JackKnifeValidation, Random10Validation
 
Fields inherited from class com.sjm.machlearn.util.MainClass
debug, debug_level, debug_listeners
 
Constructor Summary
BPNeuralNet()
           
BPNeuralNet(double hpercent)
           
 
Method Summary
 double activate(double value)
           
 Feature classify(Example example)
           
 Classifier cloneClassifier()
           
 double getAccuracy(double[][] testdata, int[] exp)
           
 double[] getError(double[] input, double[] exp)
           
 double getExampleWeight(Example example)
          getExampleWeight() : Returns the weight of an example for the class 0.
protected  double[] getOutput(double[] input)
           
protected  double[] getOutput(Example input)
           
 double getTotalError(double[] error)
           
 double getTotalError(double[] input, double[] exp)
           
 void initializeWeights()
           
 void initializeWeights(double min, double max)
           
 java.lang.String printClassifier()
           
 void reportAccuracies(int epoch, DataSet train, DataSet tune)
           
 void runEpoch(double[][] epoch_data, double[][] exp)
           
 void setParameter(int i, java.lang.Object parameter)
           
 void setTestSet(DataSet ts)
           
 void train(DataSet trainingData)
          train() : randomly pick 10% of trainingdata for tune set.
 void train(DataSet trainingData, DataSet tuneData)
           
 void trainExample(double[] input, double[] exp_output)
           
 void tune(DataSet trainingData, java.lang.Object[] parameters)
           
 
Methods inherited from class com.sjm.machlearn.classifiers.Classifier
doTune, generateROCCurve, getAccuracy, getBothCat, getMisCat
 
Methods inherited from class com.sjm.machlearn.util.MainClass
_internalError, _internalError, addDebugListener, debugMesg, debugMesg, debugMesg, debugMesg, debugMesg, debugMesg, debugOff, debugOn, internalError, internalError, setDebug, setDebugLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

whidden

protected DoubleMatrix whidden

woutput

protected DoubleMatrix woutput

feature_converter

protected BPFeatureVector feature_converter

ninputs

protected int ninputs

noutputs

protected int noutputs

nhidden

protected int nhidden

learn_rate

protected double learn_rate

trainepoch

protected int trainepoch
Constructor Detail

BPNeuralNet

public BPNeuralNet()

BPNeuralNet

public BPNeuralNet(double hpercent)
Method Detail

setTestSet

public void setTestSet(DataSet ts)

initializeWeights

public void initializeWeights()

initializeWeights

public void initializeWeights(double min,
                              double max)

getOutput

protected double[] getOutput(Example input)

getOutput

protected double[] getOutput(double[] input)

getError

public double[] getError(double[] input,
                         double[] exp)

getTotalError

public double getTotalError(double[] input,
                            double[] exp)

getTotalError

public double getTotalError(double[] error)

activate

public double activate(double value)

getExampleWeight

public double getExampleWeight(Example example)
Description copied from class: Classifier
getExampleWeight() : Returns the weight of an example for the class 0. Used for ROC curves. Will be overidden.
Overrides:
getExampleWeight in class Classifier

train

public void train(DataSet trainingData,
                  DataSet tuneData)
           throws java.lang.Exception

getAccuracy

public double getAccuracy(double[][] testdata,
                          int[] exp)

train

public void train(DataSet trainingData)
           throws java.lang.Exception
train() : randomly pick 10% of trainingdata for tune set.
Overrides:
train in class Classifier

reportAccuracies

public void reportAccuracies(int epoch,
                             DataSet train,
                             DataSet tune)

runEpoch

public void runEpoch(double[][] epoch_data,
                     double[][] exp)
              throws java.lang.Exception

trainExample

public void trainExample(double[] input,
                         double[] exp_output)

classify

public Feature classify(Example example)
Overrides:
classify in class Classifier

tune

public void tune(DataSet trainingData,
                 java.lang.Object[] parameters)

printClassifier

public java.lang.String printClassifier()
Overrides:
printClassifier in class Classifier

cloneClassifier

public Classifier cloneClassifier()
Overrides:
cloneClassifier in class Classifier

setParameter

public void setParameter(int i,
                         java.lang.Object parameter)
Overrides:
setParameter in class Classifier