public class NetMatrix extends Matrix implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
HIDDEN
A hidden neuron.
|
static int |
INPUT
An input neuron.
|
static int |
OUTPUT
An output neuron.
|
Constructor and Description |
---|
NetMatrix(int rows)
Constructs an net matrix with three extra columns and all elements marked as unused.
|
Modifier and Type | Method and Description |
---|---|
NetMatrix |
clone()
A deep clone.
|
double |
getBias(int row)
Returns a bias value.
|
int |
getBiasCount()
Returns the number of biases encoded in the matrix.
|
int |
getInputNeuronCount()
Returns the number of input neurons encoded with this matrix.
|
int |
getLinkCount()
Returns the number of links encoded in the matrix.
|
int |
getNeuronCount()
Returns the number of neurons encoded with this matrix.
|
boolean |
getPrune(int row)
Returns the prune status.
|
int |
getType(int row)
Returns a neuron type.
|
boolean |
hasPredecessor(int vertex)
Checks if a vertex has a directed edge leading to it.
|
boolean |
hasSuccessor(int vertex)
Checks if a vertex has a directed edge leaving from it.
|
boolean |
isValid()
Checks if the net has at least one input and one output neuron.
|
void |
pruneEdges(int vertex)
Prunes all the edges from and to the given vertex.
|
void |
pruneNeurons(boolean input,
boolean output)
Prunes non-functional vertices.
|
void |
setBias(int row,
double bias)
Sets a value in the bias column.
|
void |
setPrune(int row,
boolean prune)
Sets the prune status.
|
void |
setType(int row,
int type)
Sets a neuron type in the type column.
|
public static final int INPUT
public static final int HIDDEN
public static final int OUTPUT
public NetMatrix(int rows)
rows
- the number of rowspublic boolean isValid()
public int getNeuronCount()
public int getInputNeuronCount()
public boolean getPrune(int row)
row
- the rowpublic void setPrune(int row, boolean prune)
row
- the rowprune
- true, if neuron to be prunedpublic int getType(int row)
row
- the rowpublic void setType(int row, int type)
row
- the rowtype
- the typepublic double getBias(int row)
row
- the rowpublic void setBias(int row, double bias)
row
- the rowbias
- the bias valuepublic int getLinkCount()
public int getBiasCount()
public boolean hasPredecessor(int vertex)
vertex
- a vertexpublic boolean hasSuccessor(int vertex)
vertex
- a vertexpublic void pruneEdges(int vertex)
vertex
- a vertexpublic void pruneNeurons(boolean input, boolean output)
input
- true, if inputs are to be prunedoutput
- true, if outputs are to be pruned