/// <summary>
/// Connect layers from a BasicNetwork. Used internally only.
/// </summary>
/// <param name="network">The BasicNetwork.</param>
/// <param name="fromLayerIdx">The from layer index.</param>
/// <param name="source">The from layer.</param>
/// <param name="target">The target.</param>
private void ConnectLayersFromBasic(BasicNetwork network,
int fromLayerIdx, IFreeformLayer source, IFreeformLayer target)
{
for (int targetNeuronIdx = 0; targetNeuronIdx < target.Count; targetNeuronIdx++)
{
for (int sourceNeuronIdx = 0; sourceNeuronIdx < source.Count; sourceNeuronIdx++)
{
IFreeformNeuron sourceNeuron = source.Neurons[sourceNeuronIdx];
IFreeformNeuron targetNeuron = target.Neurons[targetNeuronIdx];
// neurons with no input (i.e. bias neurons)
if (targetNeuron.InputSummation == null)
{
continue;
}
IFreeformConnection connection = _connectionFactory
.Factor(sourceNeuron, targetNeuron);
sourceNeuron.AddOutput(connection);
targetNeuron.AddInput(connection);
double weight = network.GetWeight(fromLayerIdx,
sourceNeuronIdx, targetNeuronIdx);
connection.Weight = weight;
}
}
}