public abstract class LinkedLayer extends java.lang.Object implements ILayer<LinkedNeuron>
Base implementation of a hidden or output layer
Modifier and Type | Field and Description |
---|---|
protected boolean |
biased
Is biased?
|
static int |
HIDDEN_LAYER
Defines hidden layer type
|
protected int |
initialmaxnofneurons
Initial maximum number of neurons for the net
|
protected int |
maxnofneurons
Maximum number of neurons for the layer
|
protected int |
minnofneurons
Minimum number of neurons for the net
|
protected java.util.ArrayList<LinkedNeuron> |
neurons
Array of neurons of the layer
|
static int |
OUTPUT_LAYER
Defines output layer type
|
protected int |
type
Type of layer (HIDDEN_LAYER or OUTPUT_LAYER)
|
protected static <any> |
XML
Marshal/Unmarshal initial number of neurons, maximum number of
neurons, each neuron, layer type, weigth range, and a boolean
indicating if the layer is input-biased
|
Constructor and Description |
---|
LinkedLayer()
Empty constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addNeuron(LinkedNeuron neuron)
Add a neuron to the layer
|
LinkedLayer |
copy(ILayer<? extends INeuron> previousLayer)
Returns a copy of this linked layer
|
boolean |
equals(ILayer<LinkedNeuron> other)
Checks if this layer is equal to another
|
int |
getInitialmaxnofneurons()
Returns the initial maximum number of neurons of this layer
|
int |
getMaxnofneurons()
Returns the maximum number of neurons of this layer
|
int |
getMinnofneurons()
Returns the minimum number of neurons of this layer
|
LinkedNeuron |
getNeuron(int index)
Returns a neuron of the layer using its index
|
int |
getNoflinks()
Returns the number of effective links of the layer
|
int |
getNofneurons()
Returns the number of neurons of this layer
|
int |
getType()
Returns the type of this layer
|
int |
hashCode()
Returns an integer number that identifies the layer
|
boolean |
isBiased()
Returns true if the layer has a bias neuron
|
void |
keepRelevantLinks(double significativeWeight)
Keep relevant links, that is, those links whose weight is higher
than certain number
|
boolean |
linksEmpty()
Checks if this layer is empty of links
|
boolean |
linksFull(ILayer<? extends INeuron> previous)
Checks if this layer is full of links
|
boolean |
neuronsEmpty()
Checks if this layer is empty of neurons
|
boolean |
neuronsFull()
Checks if this layer is full of neurons
|
abstract LinkedNeuron |
obtainNewNeuron()
New neuron for the layer
|
LinkedNeuron |
removeNeuron(int index)
Removes a neuron of the layer using its index
|
boolean |
removeNeuron(LinkedNeuron neuron)
Removes a neuron of the layer
|
void |
setBiased(boolean isBiased)
Sets a boolean indicating if the layer has a bias neuron
|
void |
setInitialmaxnofneurons(int initialmaxnofneurons)
Sets the initial maximum number of neurons of this layer (without BIAS)
|
void |
setMaxnofneurons(int maxnofneurons)
Sets the maximum number of neurons of this layer
|
void |
setMinnofneurons(int minofneurons)
Sets the minimum number of neurons of this layer
|
void |
setType(int type)
Sets the type of this layer
|
protected static final <any> XML
Marshal/Unmarshal initial number of neurons, maximum number of neurons, each neuron, layer type, weigth range, and a boolean indicating if the layer is input-biased
public static final int HIDDEN_LAYER
public static final int OUTPUT_LAYER
protected int minnofneurons
protected int initialmaxnofneurons
protected int maxnofneurons
protected java.util.ArrayList<LinkedNeuron> neurons
protected int type
protected boolean biased
public int getMinnofneurons()
Returns the minimum number of neurons of this layer
public void setMinnofneurons(int minofneurons)
Sets the minimum number of neurons of this layer
minofneurons
- Minimum number of neuronspublic int getInitialmaxnofneurons()
Returns the initial maximum number of neurons of this layer
public void setInitialmaxnofneurons(int initialmaxnofneurons)
initialmaxnofneurons
- Initial number of neuronspublic int getType()
Returns the type of this layer
public void setType(int type)
Sets the type of this layer
type
- New type of layerpublic boolean isBiased()
Returns true if the layer has a bias neuron
public void setBiased(boolean isBiased)
Sets a boolean indicating if the layer has a bias neuron
isBiased
- Boolean has bias neuronpublic int getMaxnofneurons()
Returns the maximum number of neurons of this layer
getMaxnofneurons
in interface ILayer<LinkedNeuron>
public void setMaxnofneurons(int maxnofneurons)
Sets the maximum number of neurons of this layer
maxnofneurons
- Number of neuronspublic void addNeuron(LinkedNeuron neuron)
Add a neuron to the layer
addNeuron
in interface ILayer<LinkedNeuron>
neuron
- New neuron to add to the layerpublic boolean removeNeuron(LinkedNeuron neuron)
Removes a neuron of the layer
neuron
- Neuron to removepublic LinkedNeuron removeNeuron(int index)
Removes a neuron of the layer using its index
index
- Index of the neuron to removepublic LinkedNeuron getNeuron(int index)
Returns a neuron of the layer using its index
getNeuron
in interface ILayer<LinkedNeuron>
index
- Index of the neuron to removepublic int getNofneurons()
Returns the number of neurons of this layer
getNofneurons
in interface ILayer<LinkedNeuron>
public boolean equals(ILayer<LinkedNeuron> other)
Checks if this layer is equal to another
equals
in interface ILayer<LinkedNeuron>
other
- Other layer to comparepublic int hashCode()
Returns an integer number that identifies the layer
hashCode
in interface ILayer<LinkedNeuron>
hashCode
in class java.lang.Object
public boolean neuronsFull()
Checks if this layer is full of neurons
public boolean neuronsEmpty()
Checks if this layer is empty of neurons
public boolean linksFull(ILayer<? extends INeuron> previous)
Checks if this layer is full of links
previous
- the previous layer to check withpublic boolean linksEmpty()
Checks if this layer is empty of links
public int getNoflinks()
Returns the number of effective links of the layer
public void keepRelevantLinks(double significativeWeight)
Keep relevant links, that is, those links whose weight is higher than certain number
significativeWeight
- Significative weightpublic LinkedLayer copy(ILayer<? extends INeuron> previousLayer)
Returns a copy of this linked layer
previousLayer
- Previous layer to which copied neurons
are going to be linkedpublic abstract LinkedNeuron obtainNewNeuron()
New neuron for the layer