public class NetEvolver extends Evolver
Modifier and Type | Field and Description |
---|---|
protected NeuralNet |
net
The evolved net or the template net, if nothing to evolve.
|
protected boolean |
pruneInput
Indicates pruning of ineffective input neurons.
|
protected boolean |
pruneOutput
Indicates pruning of ineffective output neurons.
|
netEvolver, trainEvolver
Constructor and Description |
---|
NetEvolver(NeuralNet template)
Creates the NetEvolver.
|
Modifier and Type | Method and Description |
---|---|
protected void |
buildMatrix(NeuralNet template)
Builds a net matrix from an arbitrary network.
|
protected void |
createLinks(NeuralNet net)
Adds the links to the generated network.
|
protected void |
createNet(NeuralNet net)
Creates a network based on the net matrix.
|
protected void |
createNeurons(NeuralNet net)
Adds the neurons defined in matrix to net, which is built in createNet().
|
protected void |
develop()
Creates the evolved net from the net matrix.
|
int |
getBiasCount()
Returns the number of bias values to be evolved.
|
int |
getHiddenCount()
Returns the number of hidden neurons of the template.
|
int |
getInputCount()
Returns the number of input neurons of the template.
|
NeuralNet |
getNet()
Returns the evolved network.
|
int |
getNeuronCount()
Returns the total number of neurons of the template.
|
int |
getOutputCount()
Returns the number of output neurons of the template.
|
int |
getWeightCount()
Returns the number of weights (=links) to be evolved.
|
boolean |
hasLink(int row,
int column)
Checks, if a link between the given row and column in the net matrix is existent.
|
boolean |
isPruneInput()
Returns the status of input neuron pruning.
|
boolean |
isPruneOutput()
Returns the status of output neuron pruning.
|
void |
setBias(java.util.List<java.lang.Double> bias)
Sets evolved weights in the net matrix.
|
void |
setFunctions(java.util.List<Function> functions,
boolean in,
boolean out)
Puts the evolved functions on the template neurons in 'topSort', from where they are later
cloned, when the network is constructed.
|
void |
setLinks(java.util.List<java.lang.Boolean> links)
Prunes evolved links in the net matrix.
|
void |
setNeurons(java.util.List<java.lang.Boolean> neurons)
Prunes evolved neurons in the net matrix.
|
void |
setPruneInput(boolean pruneInput)
Sets the status of input neuron pruning.
|
void |
setPruneOutput(boolean pruneOutput)
Sets the status of output neuron pruning.
|
void |
setWeights(java.util.List<java.lang.Double> weights)
Sets evolved weights in the net matrix.
|
addFeature, develop, getFitnessFunction, getNetEvolver, getTrainEvolver, prepare, toString
protected NeuralNet net
protected boolean pruneInput
protected boolean pruneOutput
public NetEvolver(NeuralNet template)
template
- a network template as a base for evolutionpublic NeuralNet getNet()
public boolean isPruneInput()
public void setPruneInput(boolean pruneInput)
pruneInput
- true, if ineffective input neurons are prunedpublic boolean isPruneOutput()
public void setPruneOutput(boolean pruneOutput)
pruneOutput
- true, if ineffective output neurons are prunedpublic int getNeuronCount()
public int getInputCount()
public int getHiddenCount()
public int getOutputCount()
public void setFunctions(java.util.List<Function> functions, boolean in, boolean out)
functions
- a sorted list of activation functionsin
- true, if input neurons are includedout
- true, if output neurons are includedpublic int getWeightCount()
public boolean hasLink(int row, int column)
row
- the rowcolumn
- the columnpublic int getBiasCount()
protected void develop()
public void setWeights(java.util.List<java.lang.Double> weights)
weights
- a list of evolved weightspublic void setBias(java.util.List<java.lang.Double> bias)
bias
- a list of evolved bias valuespublic void setLinks(java.util.List<java.lang.Boolean> links)
links
- a list of evolved link markerspublic void setNeurons(java.util.List<java.lang.Boolean> neurons)
neurons
- a list of evolved neuron markersprotected void buildMatrix(NeuralNet template)
template
- a template net translated into net matrixprotected void createNet(NeuralNet net)
net
- an empty network to be populatedprotected void createNeurons(NeuralNet net)
net
- network according to the weight matrixprotected void createLinks(NeuralNet net)
net
- network according to the weight matrix