hello there
I try to update elements of a array but it does not perform correctly
for instance I have this array:
static double[,] weigh = { { 0.05, 0.1 }, { 0.2, 0.2 }, { 0.5, 0.5 } };
and I try to perform this on it:
for (k = 0; k < 2; k++)
{
if (z_input[k] > 0.0)
{
bias[k] = bias[k] + 0.5 * (-1.0 - z_input[k]);
weigh[k, 0] += (0.5 * (-1.0 - z_input[k]) * input1);
weigh[k, 1] += (0.5 * (-1.0 - z_input[k]) * input2);
}
}
it performs on w[0,0] and w[0,1] correctly but give me w[1,0] and w[1,1] wrong!
what's wrong with it?
help me
thanks
What I have tried:
static int[,] input = { { 1, 1 }, { 1, -1 }, { -1, 1 } };
static int[] target = { -1, 1, 1 };
static double[,] weigh = { { 0.05, 0.1 }, { 0.2, 0.2 } };
static double[] vector = { 0.5, 0.5 };
static double[] bias = { 0.3, 0.15, 0.5 };
static bool epoch = true;
static int input1 = 0, input2 = 0;
static int k = 0;
static double[] z_input = new double[2];
static int[] z_layer = new int[2];
static double y_input;
static int y;
if (target[j] == -1)
{
for (k = 0; k < 2; k++)
{
if (z_input[k] > 0.0)
{
bias[k] = bias[k] + 0.5 * (-1.0 - z_input[k]);
weigh[k, 0] += (0.5 * (-1.0 - z_input[k]) * input1);
weigh[k, 1] += (0.5 * (-1.0 - z_input[k]) * input2);
}
}
}