public class Sparse extends java.lang.Object implements ConnectNeurons
Modifier and Type | Field and Description |
---|---|
protected double |
connectionDensity
Generally speaking the connectionDensity parameter represents a
probability reflecting how many possible connections between a given
source neuron and all available target neurons will actually be made.
|
static double |
DEFAULT_CONNECTION_DENSITY
The default sparsity (between 0 and 1).
|
static boolean |
DEFAULT_FF_PREF
Sets the default behavior concerning whether or not the number of
efferents of each source neurons should be equalized.
|
static boolean |
DEFAULT_SELF_CONNECT_PREF
The default preference as to whether or not self connections are allowed.
|
protected boolean |
selfConnectionAllowed
Whether or not connections where the source and target are the same
neuron are allowed.
|
Constructor and Description |
---|
Sparse()
Default constructor.
|
Sparse(double sparsity,
boolean equalizeEfferents,
boolean selfConnectionAllowed)
Construct a sparse object from main arguments.
|
Modifier and Type | Method and Description |
---|---|
void |
addToSparsity(double newSparsity) |
void |
connectNeurons(SynapseGroup synapseGroup)
Apply connection to a synapse group using specified parameters.
|
java.util.List<Synapse> |
connectSparse(java.util.List<Neuron> sourceNeurons,
java.util.List<Neuron> targetNeurons)
Connect source to target neurons using this instance of the sparse
object's properties to set all parameters of the connections.
|
static java.util.List<Synapse> |
connectSparse(java.util.List<Neuron> sourceNeurons,
java.util.List<Neuron> targetNeurons,
double sparsity,
boolean selfConnectionAllowed,
boolean equalizeEfferents,
boolean looseSynapses)
Connects two lists of neurons with synapses assigning connections between
source and target neurons randomly in such a way that results in
"sparsity" percentage of possible connections being created.
|
double |
getConnectionDensity() |
int |
getMaxPossibleConnections() |
static java.lang.String |
getName()
Returns a short name for this connection type, used in combo boxes.
|
SynapseGroup |
getSynapseGroup() |
boolean |
isEqualizeEfferents() |
boolean |
isPermitDensityEditing() |
boolean |
isSelfConnectionAllowed() |
static void |
randShuffleK(java.util.ArrayList<java.lang.Integer> inds,
int k,
java.util.Random rand)
Randomly shuffles k integers in a list.
|
void |
removeToSparsity(double newSparsity) |
void |
setConnectionDensity(double connectionDensity)
Set how dense the connections are between source and target neurons,
generally speaking the connectionDensity parameter represents a
probability reflecting how many possible connections between a given
source neuron and all available target neurons will actually be made.
|
void |
setEqualizeEfferents(boolean equalizeEfferents) |
void |
setPermitDensityEditing(boolean permitDensityEditing) |
void |
setSelfConnectionAllowed(boolean selfConnectionAllowed)
Set whether or not self connections (connections where the source and
target neuron are the same neuron) are allowed.
|
java.lang.String |
toString() |
public static boolean DEFAULT_SELF_CONNECT_PREF
public static boolean DEFAULT_FF_PREF
public static double DEFAULT_CONNECTION_DENSITY
protected double connectionDensity
protected boolean selfConnectionAllowed
public Sparse()
public Sparse(double sparsity, boolean equalizeEfferents, boolean selfConnectionAllowed)
sparsity
- sparsity levelequalizeEfferents
- whether to equalize efferentsselfConnectionAllowed
- whether self-connections should be allowed.public java.util.List<Synapse> connectSparse(java.util.List<Neuron> sourceNeurons, java.util.List<Neuron> targetNeurons)
sourceNeurons
- the source neuronstargetNeurons
- the target neuronspublic static java.util.List<Synapse> connectSparse(java.util.List<Neuron> sourceNeurons, java.util.List<Neuron> targetNeurons, double sparsity, boolean selfConnectionAllowed, boolean equalizeEfferents, boolean looseSynapses)
sourceNeurons
- source neuronstargetNeurons
- target neuronssparsity
- sparsity of connectionselfConnectionAllowed
- whether to allow self-connectionsequalizeEfferents
- whether or not the number of efferents of each
source neurons should be equalized.looseSynapses
- are these loose synapsespublic void connectNeurons(SynapseGroup synapseGroup)
ConnectNeurons
connectNeurons
in interface ConnectNeurons
synapseGroup
- The synapse group that the connections this class
will generate will be added to.public static void randShuffleK(java.util.ArrayList<java.lang.Integer> inds, int k, java.util.Random rand)
inds
- a list of integers. This methods WILL shuffle inds, so pass a
copy unless inds being shuffled is not a problem.k
- how many elements will be shuffledrand
- a random number generatorpublic void removeToSparsity(double newSparsity)
newSparsity
- new sparsity connectionpublic void addToSparsity(double newSparsity)
newSparsity
- new sparsity connectionpublic int getMaxPossibleConnections()
public boolean isEqualizeEfferents()
public void setEqualizeEfferents(boolean equalizeEfferents)
public boolean isPermitDensityEditing()
public void setPermitDensityEditing(boolean permitDensityEditing)
public double getConnectionDensity()
public void setConnectionDensity(double connectionDensity)
connectionDensity
- public boolean isSelfConnectionAllowed()
public void setSelfConnectionAllowed(boolean selfConnectionAllowed)
selfConnectionAllowed
- Connections are allowed to connect to themselves.public SynapseGroup getSynapseGroup()
public static java.lang.String getName()
public java.lang.String toString()
toString
in class java.lang.Object