Package com.imsl.datamining.neural
Class Network
java.lang.Object
com.imsl.datamining.neural.Network
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
FeedForwardNetwork
Neural network base class.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]computeStatistics(double[][] xData, double[][] yData) Computes error statistics.abstract HiddenLayerCreates the nextHiddenLayerin theNetwork.abstract double[]forecast(double[] x) Returns a forecast for each of theNetwork's outputs computed from the trainedNetwork.abstract double[][]getForecastGradient(double[] x) Returns the derivatives of the outputs with respect to the weights.abstract InputLayerReturns theInputLayerobject.abstract Link[]getLinks()Returns an array containing theLinkobjects in theNetwork.abstract intReturns the number ofNetworkinputs.abstract intReturns the number ofNetworkLinks among thenodes.abstract intReturns the number ofNetworkoutputPerceptrons.abstract intReturns the number of weights in theNetwork.abstract OutputLayerReturns theOutputLayer.abstract Perceptron[]Returns an array containing thePerceptrons in theNetwork.abstract double[]Returns the weights.abstract voidsetWeights(double[] weights) Sets the weights.
-
Constructor Details
-
Network
public Network()Default constructor forNetwork. Since this class is abstract, it cannot be instantiated directly; this constructor is used by constructors in classes derived fromNetwork.
-
-
Method Details
-
getNumberOfInputs
public abstract int getNumberOfInputs()Returns the number ofNetworkinputs.- Returns:
- An
intwhich contains the number of inputs.
-
getNumberOfOutputs
public abstract int getNumberOfOutputs()Returns the number ofNetworkoutputPerceptrons.- Returns:
- An
intwhich contains the number of outputs.
-
getInputLayer
Returns theInputLayerobject.- Returns:
- The
NetworkInputLayer.
-
createHiddenLayer
Creates the nextHiddenLayerin theNetwork.- Returns:
- The new
HiddenLayer.
-
getOutputLayer
Returns theOutputLayer.- Returns:
- The
NetworkOutputLayer.
-
getPerceptrons
Returns an array containing thePerceptrons in theNetwork.- Returns:
- An array of
Perceptrons associated with thisNetwork.
-
getLinks
Returns an array containing theLinkobjects in theNetwork.- Returns:
- An array of
Links associated with thisNetwork.
-
getNumberOfLinks
public abstract int getNumberOfLinks()Returns the number ofNetworkLinks among thenodes.- Returns:
- An
intwhich contains the number ofLinks in theNetwork.
-
getWeights
public abstract double[] getWeights()Returns the weights.- Returns:
- A
doublearray containing the weights associated withNetworkLinks.
-
setWeights
public abstract void setWeights(double[] weights) Sets the weights.- Parameters:
weights- Adoublearray which specifies the weights to be associated withNetworkLinks.
-
getNumberOfWeights
public abstract int getNumberOfWeights()Returns the number of weights in theNetwork.- Returns:
- An
intwhich contains the number of weights associated with thisNetwork.
-
forecast
public abstract double[] forecast(double[] x) Returns a forecast for each of theNetwork's outputs computed from the trainedNetwork.- Parameters:
x- Adoublearray of values with the same length and order as the training patterns used to train theNetwork.- Returns:
- A
doublearray containing the forecasts for the outputPerceptrons. Its length is equal to the number of outputPerceptrons.
-
getForecastGradient
public abstract double[][] getForecastGradient(double[] x) Returns the derivatives of the outputs with respect to the weights.- Parameters:
x- Adoublearray which specifies the input values at which the gradient is to be evaluated.- Returns:
- A
doublearray containing the gradient values. The value ofgradient[i][j]is \(dy_i/dw_j\), where \(y_i\) is the i-th output and \(w_j\) is the j-th weight.
-
computeStatistics
public double[] computeStatistics(double[][] xData, double[][] yData) Computes error statistics.This is a static method that can be used to compute the statistics regardless of the training class used to train the
Network.Computes statistics related to the error. In this table, the observed values are \(y_i\). The forecasted values are \(\hat{y}_i\). The mean observed value is \( \bar{y} = \sum_i y_i / NC\), where N is the number of observations and C is the number of classes per observation.
Index Name Formula 0 SSE \(\frac{1}{2}\sum_i\left(y_i-\hat{y}_i\right)^2\) 1 RMS \(\frac{\sum_i \left(y_i-\hat{y}_i\right)^2}{\sum_i \left(y_i-\bar{y}_i\right)} \) 2 Laplacian \(\sum_i \left|y_i-\hat{y}_i\right|\) 3 Scaled Laplacian \(\frac{\sum_i \left|y_i-\hat{y}_i\right|}{\sum_i\left|y_i-\bar{y}_i\right|}\) 4 Max residual \(\max_i\left|y_i-\hat{y}_i\right|\) - Parameters:
xData- Adoublematrix containing the input values.yData- Adoublearray containing the observed values.- Returns:
- A
doublearray containing the above described statistics.
-