I've successfully built the program which has 9 inputs, 2 outputs and 2 hidden layers using bipolar sigmoid function.
I take number of neurons for each hidden layer, learning rate, momentum and initializing values of weights from user
but my network is not consistent;
I get different results each time i train network with same parameters.
I've checked everything and only thing i can think of is threshold and documentation says threshold is not a member of "neuron" but "activationNeuron" and i can't access it like i do for weights; "network.Layers[i].Neurons[j]."
Is there any way to access and change threshold value of my neurons?
Or the cause of inconsistency is something else? ( checked my code hundred times ).
Any help is appreciated, thanks.
(I'm not a native English speaker so apologies in advance for any mistakes )
- Code: Select all
ActivationNetwork network = new ActivationNetwork(
new BipolarSigmoidFunction(1) , 9, (int)numericUpDown1.Value, (int)numericUpDown2.Value, 2);
listBox1.Items.Add("training");
BackPropagationLearning back = new BackPropagationLearning(network);
back.LearningRate = (double)numericUpDown4.Value;
back.Momentum = (double)numericUpDown5.Value;
for (int i = 0; i < 3; i++)
{
for(int j = 0; j < network.Layers[i].Neurons.Length; j++)
{
for(int k = 0; k< network.Layers[i].Neurons[j].Weights.Length; k++)
{
network.Layers[i].Neurons[j].Weights[k] = (double)numericUpDown3.Value;
}
}
}
int epoch = 1;
while ( epoch <= numericUpDown6.Value)
{
double error = back.RunEpoch(dataset1.inputs,dataset1.outputs);
if (epoch % 100 == 0)
{
listBox1.Items.Add("epoch:" + epoch + " Error:" + error);
listBox1.SelectedIndex = listBox1.Items.Count - 1;
chart1.Series[0].Points.AddXY(epoch, Math.Round(error,4));
}
epoch++;
}