jhplot
Class HNeuralNet
- java.lang.Object
-
- jhplot.HNeuralNet
-
public class HNeuralNet extends java.lang.Object
Neural Netwrork calculations. Based on Backpropagation.
-
-
Constructor Summary
Constructors Constructor and Description HNeuralNet()
Create a network net and set name for the network
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
addFeedForwardLayer(int neuronCount)
Construct this layer with a sigmoid threshold function.void
addFeedForwardLayerWithBias(int neuronCount)
Construct this layer with a sigmoid threshold function.AnalyzeNetwork
analyzeNetwork()
Analyse the current neural network.void
doc()
Show online documentation.BasicNetwork
editNetwork()
Edit a neural net in a frameBasicNeuralDataSet
getData()
Get datajava.util.ArrayList<java.lang.Double>
getEpochError()
Returns errors for each epoch.BasicNetwork
getNetwork()
Return neural net back.MLData
predict(MLData input)
Evaluate data using current NNP0D
predict(P0D input)
Generate prediction for input dataPND
predict(PND input)
Generate predictions for all input data.int
read(java.lang.String file)
Read a neural net from a file.void
reset()
Reset the weight matrix and the thresholds.java.lang.String
save(java.lang.String file)
Save current status of neural net.void
setData(double[][] input)
Construct a data set from an inputvoid
setData(double[][] input, double[][] ideal)
Construct a data set from an input and idea array.void
setData(PND input)
Set datavoid
setData(PND input, PND ideal)
Set data for training.void
show()
Show Net in EncodeDocument.void
showNetwork()
Show a neural net in a frame.void
showWeights()
Show a neural net weights in a separate frame.PND
standardize(PND input)
Standardize each column.int
trainBackpropagation(boolean isShow, int maxEpoch, double learnRate, double momentum, double errorMinEpoch)
Training neural network.Construct a backpropagation trainer.
-
-
-
Constructor Detail
-
HNeuralNet
public HNeuralNet()
Create a network net and set name for the network- Parameters:
name
- name for the network
-
-
Method Detail
-
reset
public void reset()
Reset the weight matrix and the thresholds.
-
addFeedForwardLayer
public void addFeedForwardLayer(int neuronCount)
Construct this layer with a sigmoid threshold function. Use sigmoid for activation.- Parameters:
neuronCount
- How many neurons in this layer
-
addFeedForwardLayerWithBias
public void addFeedForwardLayerWithBias(int neuronCount)
Construct this layer with a sigmoid threshold function. Use sigmoid for activation.- Parameters:
neuronCount
- How many neurons in this layer
-
setData
public void setData(double[][] input, double[][] ideal)
Construct a data set from an input and idea array. Used for supervized training.- Parameters:
input
- The input into the neural network for training.ideal
- The ideal output for training.
-
setData
public void setData(double[][] input)
Construct a data set from an input- Parameters:
input
- The input into the neural network for training.
-
setData
public void setData(PND input, PND ideal)
Set data for training.- Parameters:
input
- input data setideal
- expected resul.
-
setData
public void setData(PND input)
Set data- Parameters:
input
- input data set
-
standardize
public PND standardize(PND input)
Standardize each column. This means S(i)= (X(i) - mean) / std fot each column in PND;- Parameters:
input
- PND- Returns:
- new PND after standardize
-
getData
public BasicNeuralDataSet getData()
Get data- Returns:
- data
-
predict
public P0D predict(P0D input)
Generate prediction for input data- Parameters:
input
- input data for predictions
-
predict
public PND predict(PND input)
Generate predictions for all input data. Assumes that the predicted array has less then 3 dimensions.- Parameters:
input
- input data for prediction- Returns:
- data with predictions
-
trainBackpropagation
public int trainBackpropagation(boolean isShow, int maxEpoch, double learnRate, double momentum, double errorMinEpoch)
Training neural network.Construct a backpropagation trainer. Typical example: train(5000, 0.1, 0.25, 0.001);- Parameters:
isShow
- Show learning on a pop-up plotmaxEpoch
- maximum number of epochslearnRate
- The rate at which the weight matrix will be adjusted based on learning.momentum
- The influence that previous iteration's training deltas will have on the current iteration.errorMinEpoch
- min error for epoch.- Returns:
- returns the epoch at which training was stopped.
-
save
public java.lang.String save(java.lang.String file)
Save current status of neural net.- Parameters:
file
- File name- Returns:
- what is done
-
read
public int read(java.lang.String file)
Read a neural net from a file.- Parameters:
file
- File name- Returns:
- 0 if it is OK. -1 if file not found; -2: if NN not found.
-
getNetwork
public BasicNetwork getNetwork()
Return neural net back.- Returns:
- network
-
showNetwork
public void showNetwork()
Show a neural net in a frame.
-
showWeights
public void showWeights()
Show a neural net weights in a separate frame.
-
analyzeNetwork
public AnalyzeNetwork analyzeNetwork()
Analyse the current neural network.- Returns:
- analyzer
-
editNetwork
public BasicNetwork editNetwork()
Edit a neural net in a frame
-
show
public void show()
Show Net in EncodeDocument.
-
getEpochError
public java.util.ArrayList<java.lang.Double> getEpochError()
Returns errors for each epoch. If the max epoch number was set in the train() method. The array may have less entries if learning has reached the minimum error.- Returns:
- arrays of errors for each epoch
-
doc
public void doc()
Show online documentation.
-
-
DMelt 3.0 © DataMelt by jWork.ORG