|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--NNeco
NNeco.java
Title : Learning Industry with ANN based GenFirms
Description : A simple back propagation feed forward neural
network adapted for being driven by another user
class. It has only one hidden layer.
Adapted with corrections from the Neural class by Mark Watson, 1997,
Intelligent Java Applications, Morgan Kaufmann, SF:CA.
My modifications are based on T. Masters, 1993, Practical Neural Recipes
in C++, Academic Press, San Diego: CA. The later is a very nice reference
on ANNs.
Copyright : Copyright (c) Murat Yildizoglu August 2001
Permission to use, copy, modify, and distribute this
software and its documentation for NON-COMMERCIAL purposes
and without fee is hereby granted provided that this
copyright notice appears in all copies.
*************************************************************
| Field Summary | |
protected double[] |
Hidden
|
protected double[] |
hidden_errors
|
double[] |
Inputs
|
protected int |
NumHidden
|
protected int |
NumInputs
|
protected int |
NumOutputs
|
protected int |
NumTraining
|
protected double[] |
output_errors
|
double[] |
Outputs
|
protected double[][] |
W1
|
protected double[][] |
W2
|
| Constructor Summary | |
NNeco()
The default constructor. |
|
NNeco(int i,
int h,
int o)
The constructor that should be used for creating a new network |
|
| Method Summary | |
void |
forwardPass()
Calculates outputs with actual weights and input vector. |
double[] |
getOutputs()
This method returns the actual values of the outputs resulting from the last forward pass. |
double |
getTotalOutputError()
Returns the total error in the last training sesssion |
double[] |
infer(double[] inputs)
This is the method for obtaining predictions from the network. |
void |
randomizeWeights()
Puts randomly chosen values to all weights |
void |
setInputs(double[] inputs)
This method uses the provided one-dimensional array for setting the values of the inputs |
protected double |
Sigmoid(double x)
The sigmoid function used for activation |
protected double |
SigmoidP(double x)
The derivative of the sigmoid function. |
void |
Train(double[][] ins,
double[][] outs,
int numEpoch,
int numCases,
int winSize)
Takes the data in a more standard two dimensional table and adapts it for using in the real train method. |
double |
Train(double[] ins,
double[] outs,
int num_cases)
This method is called by the preceding Train method, it should not be directly called. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected int NumInputs
protected int NumHidden
protected int NumOutputs
protected int NumTraining
public double[] Inputs
protected double[] Hidden
public double[] Outputs
protected double[][] W1
protected double[][] W2
protected double[] output_errors
protected double[] hidden_errors
| Constructor Detail |
public NNeco()
public NNeco(int i,
int h,
int o)
i - number of inputsh - number of hidden nodes on the hidden layero - number of outputs| Method Detail |
public void randomizeWeights()
public void forwardPass()
public void Train(double[][] ins,
double[][] outs,
int numEpoch,
int numCases,
int winSize)
ins - two-dimensional table where each case is a line of input valuesouts - two-dimensional table where each case is a line of output valuesnumEpoch - the number of runs in each epochnumCases - the size of the epoch (number of training cases)winSize - the number of observations to use from the end of the tables. 0 means all observations.
public double Train(double[] ins,
double[] outs,
int num_cases)
public double[] infer(double[] inputs)
inputs - a one-dimensional array that contains the vector of input valuespublic double[] getOutputs()
public double getTotalOutputError()
public void setInputs(double[] inputs)
inputs - a one-dimensional array of iputs values.protected double Sigmoid(double x)
x - protected double SigmoidP(double x)
x -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||