class: BP_network

public class: BP_network
Author: Lukáš Civín
Project: Phase: 1.0; Status: Proposed; Version: 1.0; Complexity: 1
Dates: Created: 7.12.2005 22:45:10; Modified: 7.12.2005 22:45:10;
Flags: Active: false; IsRoot: false; IsLeaf: false;
Extension Points:
UUID: {EF0BAC7E-6C38-452d-8786-E996D33C57F2}
Classical BP network with layers and nodes includes BP-learning InitializeNet -> InitializeLayers -> TrainNetwork

 

Goto: Fields, Methods

See also: BP_net_list, BP_layer, ErrStep, BP_Visualiss, Form1

Appears in: Network core classes

Connections
 
BP_network Attributes
Attribute Details
private BP_layer
  Layers
Notes: The array of pointers to all layers of this network

private double
  TotErr
Notes: Total error of BP network (is changing)

private int
  NumOfLay
Notes: Number of Layers (input+hidden+output)

private int
  NumOfInputs
Notes: Dimension of array entering the Net (or the number of nodes in the first layer)

private int
  NumOfOutput
Notes: Dimension of array leaving the Net (or the number of nodes in the last layer)

private TimeSpan
  Timeout
Notes: Max Timeout of training the net

private int
  Cycle
Notes: Total number of cycles through the set of learning templates

private double
  MinErr
Notes: Maximal value of Error when the training stops

public DateTime
  StartTime
Notes: Timestamp of the start of the net learning

public double
  LearningPar
Notes: Learning parameter for BP net learning

public double
  LearningMov
Notes: Learning Movement for the BP net

public double
  SlopePar
Notes: Parameter of gradient slope of sigmoidal function

public double
  Steps
Notes: How many steps have already been done

private DMTransformStruct.Version
  ver
Notes: the version of input/output data

private int
  Iteration
Notes: Number of iterations of one patterns through the cycle

public ArrayList
  ErrorList
Notes: List of errors of the network

private double
  ActualErrorPat
Notes: Actual Error for one pattern

 
BP_network Methods
Operation Details
public
BP_network(
   DMTransformStruct.Version vers,
   DataTable layers,
   long timeout,
   int cycle,
   double minErr):
Sequential
Notes: The constructor needs the table of actual data and table with count of the layers and nodes (each row is one layer and the only one column is the number of nodes in this layer)
public
BP_network(
   DMTransformStruct.Version vers,
   DataTable layers,
   double learnpar,
   double learnmom,
   double initThreshold,
   double initWeights,
   long timeout,
   int cycle,
   double minErr,
   double Slope,
   int iter):
Sequential
Notes: The constructor needs the table of actual data and table with count of the layers and nodes (each row is one layer and the only one column is the number of nodes in this layer), initial weights and thresholds
private
InitializeNet(
   DMTransformStruct.Version vers,
   DataTable layers,
   double learnpar,
   double learnmom,
   long timeout,
   int cycle,
   double minErr,
   double Slope,
   int iteration):void
Sequential
Notes: The first initializing function of constants of the net
private
InitializeLayers(
   BP_layer [] Lay,
   DataTable layers,
   double maxThr,
   double maxWeigh):void
Sequential
Notes: This function will initialize all nodes in layers of this NN with weight and thresholds
public
TrainNetwork(
   ProgressBar PG,
   ArrayList InputColumns,
   ArrayList OutputColumns):void
Sequential
Notes: The base of all training steps of BP network, it uses prepared input table, desired output table and initialized BP-N
public
StepTrainNet(
   double count,
   DataSrc dsrc,
   ArrayList inp,
   ArrayList desout):int
Sequential
Notes: One step in the life of training the net (one cycle through patterns)

@returns
private
FindMetCondition(
   double cycle):int
Sequential
Notes: Searches if some conditions are reached to stop training the Net

@returns position of status bar - step or %of whole
private
TrainOnePat(
   object [] data,
   ArrayList inp,
   ArrayList outp):void
Sequential
Notes: Training input for one pattern from table - this is the beginning of BP

@param ="desout" the numbers of columns of desired output
public
FillDoubles(
   double [] arr,
   object [] data,
   ArrayList columns):void
Sequential
Notes: Fill the array with doubles
private
TraceForward(
   double [] inp):void
Sequential
Notes: Feeding BP net with pattern and tracing through it We also change the Potential of all nodes
private
CalcErrOut(
   double [] desoutput):void
Sequential
Notes: Calculate total error in the last layer and add it into TotErr it is (y-d)^2 And also calculate delta in output error
private
BackProp():void
Sequential
Notes: Function of BackPropagation with correcting weights and thresholds
private
CalcDeltaIn(
   int layer):void
Sequential
Notes: In BP we have to calculate incomming error from higher layer (this) So we must calculate Delta Sum(Delta(higher(j))*weight(ij))*y(i)*(1-y(i))*slopePar
private
CalcDeltaOut(
   double [] desout):void
Sequential
Notes: Calculating Delta in output layer
public
TableDim(
   DataTable TheTable):int
Sequential
Notes: returning the number of records in the table

@returns number of records
public
Result(
   double [] param):double
Sequential
Tags: array=[]
Notes: unknown pattern is inserted into Neural network

@returns output of the network
public
Vypis():void
Sequential
public
NumOfLays():int
Sequential <<property>>
Tags: readonly=true
Notes: total count of layers - input + hidden + output
public
NumOfInp():int
Sequential <<property>>
Tags: readonly=true
Notes: total count of Input nodes
public
Lay():BP_layer
Sequential <<property>>
Tags: array=[]
readonly=true
Notes: pointer to layers of the net
public
Error():double
Sequential <<property>>
Tags: readonly=true
Notes: Total error for information
public
WriteNet(
   XmlDocument w,
   XmlNode nod):int
Sequential
Notes: write net to a XML document

@returns 0 if it is OK
public
ReadNet(
   XmlTextReader reader):int
Sequential
Notes: Reads informations about the Net from a stream

@returns 0 if OK
public static
GetXmlInt(
   int Value,
   XmlReader reader):int
Sequential
Notes: To read an Int32 from element
public static
GetXmlDouble(
   double Value,
   XmlReader reader):int
Sequential
Notes: To read a Double from XML
public
NetSet(
   int c,
   int t,
   double e,
   double l,
   double m,
   double s,
   int i):void
Sequential
Notes: To update a net
public
NumOfOut():int
Sequential <<property>>
Tags: readonly=true
Notes: number of outputs
public
CycleToTake():int
Sequential <<property>>
Tags: readonly=true
Notes: Total number of cycles through the data
private
WhereIsError():int
Sequential
Notes: Approximately where is total error of the net
private
WhereIsTimeout():int
Sequential
Notes: Approximately where is total timeout of learning of the net
public
Tim():TimeSpan
Sequential <<property>>
Tags: readonly=true
Notes: Timeout for learning
public
MinE():double
Sequential <<property>>
Tags: readonly=true
Notes: Minimal error to reach while learning
public
Iter():int
Sequential <<property>>
Tags: readonly=true
Notes: Number of iteration of one pattern