Function Run(ArrayOfInputs As Variant) As Variant 'It returns the output in form of array
Dim i, j, k As Integer
If UBound(ArrayOfInputs) <> Network.Layers(1).NeuronCount Then
Run = 0
Exit Function
End If
For i = 1 To Network.LayerCount
DoEvents
For j = 1 To Network.Layers(i).NeuronCount
DoEvents
If i = 1 Then
Network.Layers(i).Neurons(j).Value = ArrayOfInputs(j) 'Set the value of input layer
Else
Network.Layers(i).Neurons(j).Value = 0 'First set the value to zero
For k = 1 To Network.Layers(i - 1).NeuronCount
DoEvents
'Calculating the value
Network.Layers(i).Neurons(j).Value = Network.Layers(i).Neurons(j).Value + (contd on next line)
+ Network.Layers(i - 1).Neurons(k).Value * Network.Layers(i).Neurons(j).Dendrites(k).Weight
Next k
Network.Layers(i).Neurons(j).Value = Activation(Network.Layers(i).Neurons(j).Value + (contd on next line)
+ Network.Layers(i).Neurons(j).Bias) 'Calculating the real value of neuron
End If
Next j
Next i
ReDim OutputResult(Network.Layers(Network.LayerCount).NeuronCount) As Double
For i = 1 To (Network.Layers(Network.LayerCount).NeuronCount)
DoEvents
OutputResult(i) = (Network.Layers(Network.LayerCount).Neurons(i).Value) 'The array of output result
Next i
Run = OutputResult
End Function