marf.Classification.NeuralNetwork
Class Neuron

java.lang.Object
  extended by java.lang.Thread
      extended by marf.util.BaseThread
          extended by marf.Classification.NeuralNetwork.Neuron
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable

public class Neuron
extends BaseThread
implements java.io.Serializable

Class Neuron -- a basic element of a neural network.

$Id: Neuron.java,v 1.19 2007/12/31 00:17:04 mokhov Exp $

Since:
0.0.1
Version:
$Revision: 1.19 $
Author:
Ian Clement, Serguei Mokhov
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  double dDelta
          Used in error calculation.
protected  double dResult
          Current Neuron's result.
protected  double dThreshold
          Activation threshold.
static int HIDDEN
          Indicates middle (hidden) neuron.
static int INPUT
          Indicates input neuron.
protected  int iType
          Current neuron type.
static int OUTPUT
          Indicates output neuron.
protected  java.lang.String strName
          Neuron's name.
static int UNDEF
          Indicates undefined neuron type.
 
Fields inherited from class marf.util.BaseThread
iTID, oTarget, siNextTID
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Neuron(java.lang.String pstrName, int piType)
          Neuron's Constructor.
 
Method Summary
 boolean addInput(Neuron poInputNeuron, double pdWeight)
          Adds an input neuron and its associated weight.
 boolean addOutput(Neuron poOutputNeuron)
          Adds an output neuron.
 void commit()
          Applies weight changes.
 void eval()
          Evaluates current neuron's value.
static java.lang.String getMARFSourceCodeRevision()
          Retrieves class' revision.
 void printXML(java.io.BufferedWriter poWriter, int piTabsNum)
          Dumps XML of the current Neuron.
 void run()
          The body of a Neuron thread.
 void train(double pdExpected, double pdAlpha, double pdBeta)
          Neuron training.
 
Methods inherited from class marf.util.BaseThread
getNextTID, getTarget, getTID
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEF

public static final int UNDEF
Indicates undefined neuron type.

Since:
0.1.2
See Also:
Constant Field Values

INPUT

public static final int INPUT
Indicates input neuron.

Since:
0.1.2
See Also:
Constant Field Values

HIDDEN

public static final int HIDDEN
Indicates middle (hidden) neuron.

Since:
0.1.2
See Also:
Constant Field Values

OUTPUT

public static final int OUTPUT
Indicates output neuron.

Since:
0.1.2
See Also:
Constant Field Values

strName

protected java.lang.String strName
Neuron's name.


iType

protected int iType
Current neuron type.


dDelta

protected double dDelta
Used in error calculation.


dThreshold

protected double dThreshold
Activation threshold.


dResult

protected double dResult
Current Neuron's result.

Constructor Detail

Neuron

public Neuron(java.lang.String pstrName,
              int piType)
Neuron's Constructor.

Parameters:
pstrName - Neuron's name
piType - Neuron's type
Method Detail

addInput

public final boolean addInput(Neuron poInputNeuron,
                              double pdWeight)
Adds an input neuron and its associated weight.

Parameters:
poInputNeuron - Neuron to be added
pdWeight - associated weight
Returns:
true if add was successful

addOutput

public final boolean addOutput(Neuron poOutputNeuron)
Adds an output neuron.

Parameters:
poOutputNeuron - the Neuron to add
Returns:
true if the neuron was added

eval

public final void eval()
Evaluates current neuron's value.


train

public final void train(double pdExpected,
                        double pdAlpha,
                        double pdBeta)
Neuron training.

Parameters:
pdExpected - expected value
pdAlpha - used in error calculation (training constant)
pdBeta - used in error calculation

commit

public final void commit()
Applies weight changes.


printXML

public final void printXML(java.io.BufferedWriter poWriter,
                           int piTabsNum)
                    throws java.io.IOException
Dumps XML of the current Neuron.

Parameters:
poWriter - Writer object to write output to
piTabsNum - tabulation needed
Throws:
java.io.IOException - if there is any problem to output to the writer

run

public void run()
The body of a Neuron thread. TODO: complete.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
Since:
0.3.0.2

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Retrieves class' revision.

Returns:
revision string
Since:
0.3.0.2


SourceForge Logo