Click here to Skip to main content
15,441,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all

I am trying to learn Neural Networks and was trying to implement a simple Shape Recognition Alogithm in C# and AForge using Distance Histograms normalized to Values between 0 and 100.

A distance Histogram of a bone shape looks like this:

int[] boneHistogram = 77, 38, 30, 27, 25, 22, 22, 22, 22, 20, 21, 20, 13, 11, 14, 13, 14, 13, 16, 16, 17, 27, 28, 34, 41, 46, 58, 100, 65, 0,  


I computed it like described here on page 41: http://www.ai.rug.nl/~mwiering/ObjectRecognition.pdf

Now I produce a couple of those histograms. Results look like so:

int[]bone2Histogram = 63, 39, 27, 25, 20, 22, 20, 18, 19, 22, 16, 21, 17, 20, 19, 20, 20, 14, 21, 16, 20, 19, 27, 44, 42, 56, 70, 100, 64, 0

int[] bone3Histogram = 62, 46, 33, 27, 24, 22, 23, 19, 22, 20, 19, 19, 19, 18, 19, 20, 16, 19, 17, 22, 16, 25, 31, 35, 48, 52, 66, 100, 60, 0

...


and so on until I have 8 histograms.
Nect I create an input array:

double[][] input = new double[8][];


I put the histogram values from above each into a array so that input[0] corresponds to histogram 1 and input[1] to histogram 2...

First Problem I have: I don't really understand how to use the output values here. I know the output array has to be the same size of the input array so I create it like so:

double[][] output = new double[input.Length][];


Now does output[1].Length need to be like 30 cells or does it work with one cell? And what do I need to put into those cells? Do I need to put the same values as in Input in there or does it work with say 1 for true and 0 for false (if the corresponding input histogram is a false shape)?

I tried to apply what is descriped here Neural Network OCR[^]but it didn't help me really


Second Problem
My Network then looks like this:

C#
AForge.Neuro.ActivationNetwork network = new AForge.Neuro.ActivationNetwork(
			new SigmoidFunction(2),
			30, // two inputs in the network
			30, // two neurons in the first layer
			1); // one neuron in the second layer

network.Randomize();

AForge.Neuro.Learning.BackPropagationLearning teacher = new BackPropagationLearning(network);

int count = 0;
double error = 1;
// loop
do
{
	error = 0;
	// run epoch of learning procedure
	error = teacher.RunEpoch(input, output);
	//Debug.Log(error);
	// check error value to see if we need to stop
	count++;
	if(count >= 2000) break;
} while (error > 0.01);


When I then try to compute different shapes (say comparing it with a the values of an input bone)
C#
double[] boneShape = new double[] {
77, 38, 30, 27, 25, 22, 22, 22, 22, 20, 21, 20, 13, 11, 14, 13, 14, 13, 16, 16, 17, 27, 28, 34, 41, 46, 58, 100, 65, 0
};
			
double[] resultBone = network.Compute(boneShape);

double[] randomValues = new double[] {
14, 3, 0, 3, 40, 50, 93, 0, 34, 8, 5, 6, 10, 1, 33, 70, 80, 0, 12, 5, 3, 33, 77, 40, 3, 2, 3, 0, 3, 20
};

double[] test = network.Compute(randomValues);


I just get wrong answers depending on my settings above. What I want is a value between 0 and 1. The lower the value, the better (say 0 is 100% sure it is a equivalent shape and 1 is a totally different shape)

Are Neural Networks the right approach for such a problem? DistanceHistograms won't be too reliable but it's a start.

I really hope someone can point me in the right direction and help me getting started, because this clearly doesn't work.
Posted
Updated 27-Jan-15 10:50am
v2

1 solution

I somehow managed to solve the problem by myself. It works, althought I think it might need refinement. What I do now is I create a Neuronal Network for each Shape and add all the histogram data of all the shapes into each network but define an Output Value of 0.5 for histograms that match that shape and an Output Value of -0.5 for all other shape histograms.

Example Input and Output looks like this:

 input: -0.43, -0.12, -0.27, 0.5, 0.26, -0.12, -0.35, -0.2, -0.27, -0.35, -0.04, -0.12, -0.35, -0.12, -0.27, -0.2, -0.27, -0.43, -0.12, -0.2, 0.03, -0.43, -0.43, -0.35, -0.43, -0.5, -0.35, -0.35, -0.5, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.23, -0.41, 0.04, -0.32, -0.23, -0.14, 0.04, -0.23, 0.5, 0.4, 0.13, -0.14, 0.13, -0.23, 0.4, 0.04, -0.5, 0.04, 0.22, -0.32, -0.14, -0.5, -0.32, -0.23, -0.41, -0.41, -0.14, -0.23, -0.41, -0.41,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.23, -0.23, -0.14, -0.32, -0.23, -0.14, 0.13, -0.14, 0.5, 0.22, 0.13, -0.14, 0.13, -0.14, 0.31, 0.04, -0.5, 0.04, 0.22, -0.32, -0.14, -0.5, -0.32, -0.23, -0.41, -0.41, -0.14, -0.23, -0.41, -0.41,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: 0.25, 0.25, 0.25, 0, -0.38, -0.13, 0.12, 0.5, 0.25, 0.37, -0.38, 0.25, -0.38, 0.12, 0.12, -0.13, 0, -0.25, -0.25, 0, 0, -0.13, -0.38, -0.38, -0.5, -0.25, -0.5, -0.25, -0.38, -0.38,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: 0.5, 0.35, -0.08, -0.08, -0.08, 0.07, 0.35, 0.21, 0.5, 0.21, -0.36, 0.35, -0.08, 0.21, 0.07, -0.08, 0.07, -0.36, 0.21, -0.08, 0.07, -0.22, -0.36, -0.36, -0.5, -0.22, -0.5, -0.22, -0.36, -0.36,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.1, -0.1, -0.1, -0.04, 0.23, -0.04, -0.17, 0.5, 0.1, 0.1, -0.3, 0.03, -0.3, 0.1, -0.1, -0.1, -0.1, -0.24, -0.1, -0.04, -0.1, -0.24, -0.3, -0.17, -0.44, -0.37, -0.5, -0.37, -0.37, -0.44,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: 0.5, 0.05, 0.05, 0.35, 0.02, 0.05, -0.05, -0.13, -0.1, -0.1, -0.15, -0.15, -0.2, -0.18, -0.18, -0.23, -0.18, -0.23, -0.2, -0.2, -0.23, -0.2, -0.2, -0.23, -0.38, -0.43, -0.43, -0.43, -0.45, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: 0.32, -0.2, -0.29, -0.29, -0.29, 0.5, 0.5, 0.19, 0.19, -0.03, -0.03, 0.02, 0.1, -0.07, -0.2, -0.24, -0.24, -0.2, -0.29, -0.2, -0.2, -0.29, -0.2, -0.29, -0.2, -0.29, -0.2, -0.29, -0.29, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: 0.5, -0.05, -0.09, -0.17, -0.19, 0.18, 0.12, 0.04, -0.07, -0.07, -0.13, -0.11, -0.11, -0.15, -0.19, -0.17, -0.15, -0.19, -0.17, -0.21, -0.4, -0.44, -0.4, -0.44, -0.4, -0.44, -0.4, -0.44, -0.44, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.1, -0.3, 0.4, 0.3, 0.5, 0.1, -0.2, 0.1, -0.1, -0.5, -0.2, -0.3, 0, -0.1, -0.2, -0.4, 0, -0.3, -0.1, 0.1, -0.2, -0.1, -0.4, -0.5, -0.3, -0.3, -0.4, -0.4, -0.4, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: 0.22, 0.13, -0.14, 0.5, 0.13, 0.22, -0.05, 0.13, 0.4, -0.05, 0.13, -0.05, -0.23, -0.14, -0.14, -0.05, -0.41, 0.04, -0.23, -0.05, -0.14, -0.14, -0.32, -0.23, -0.05, -0.32, -0.41, -0.5, -0.5, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.23, -0.14, 0.13, -0.05, -0.05, 0.5, -0.05, 0.22, -0.14, -0.32, -0.05, -0.14, -0.14, -0.32, -0.23, -0.32, -0.05, -0.23, -0.05, -0.23, -0.23, -0.23, -0.23, -0.5, -0.5, -0.5, -0.5, -0.5, -0.32, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.25, -0.34, 0.5, -0.09, 0, -0.17, -0.25, 0, 0.16, -0.34, 0.25, 0, 0, -0.17, -0.09, -0.17, -0.17, -0.09, -0.34, -0.34, -0.25, -0.34, -0.42, -0.42, -0.34, -0.5, -0.34, -0.42, -0.42, -0.42,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: 0.5, 0.04, 0.22, 0.13, -0.23, -0.14, -0.32, 0.04, -0.05, -0.32, -0.41, -0.14, -0.23, -0.23, -0.32, -0.41, -0.23, -0.23, -0.14, -0.32, -0.14, -0.41, -0.14, -0.41, -0.14, -0.5, -0.41, -0.5, -0.41, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.2, -0.2, 0.4, -0.2, 0.5, 0.1, 0.3, -0.2, -0.2, 0.1, -0.4, -0.3, -0.2, -0.2, -0.2, -0.5, 0, -0.4, -0.2, -0.2, -0.2, -0.4, 0.5, -0.3, -0.3, -0.5, -0.2, -0.5, -0.5, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.34, 0.25, 0.08, 0.25, 0, 0.25, 0.16, 0.5, 0.16, 0.25, 0.33, 0.08, 0, -0.25, 0.16, 0.16, 0, 0.08, -0.17, 0.08, -0.09, -0.34, -0.17, -0.17, -0.34, -0.25, -0.34, -0.42, -0.5, -0.42,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.41, -0.32, -0.14, 0.13, 0.13, -0.5, 0.04, -0.23, -0.14, 0.04, 0.04, -0.32, 0.5, -0.32, -0.23, -0.14, -0.14, -0.41, -0.32, -0.05, -0.5, 0.22, -0.5, -0.41, -0.5, -0.23, -0.5, -0.41, -0.5, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.24, -0.3, -0.37, -0.04, -0.17, -0.1, -0.04, -0.04, 0.03, 0.5, -0.24, -0.1, 0.03, -0.04, -0.04, -0.17, -0.17, -0.37, -0.3, -0.44, -0.37, -0.37, -0.44, -0.5, -0.37, -0.5, -0.37, -0.44, -0.5, -0.44,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.38, -0.25, 0.12, 0.25, 0.5, 0, 0.25, 0.12, -0.38, 0, -0.13, -0.13, -0.25, 0, -0.38, -0.13, -0.25, -0.13, -0.5, -0.13, -0.13, -0.25, -0.25, -0.25, 0, -0.25, -0.38, -0.25, -0.5, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: 0.05, 0.05, 0.5, 0.16, -0.06, 0.27, -0.28, 0.16, -0.17, -0.06, -0.28, -0.17, -0.28, -0.39, -0.06, -0.28, -0.06, -0.28, -0.28, 0.38, -0.5, -0.28, -0.5, -0.39, -0.39, -0.39, -0.5, -0.39, -0.5, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.15, -0.15, 0, -0.36, -0.15, -0.22, -0.15, -0.15, -0.08, 0.5, 0, -0.08, 0.14, 0.14, -0.22, -0.29, -0.29, -0.29, -0.29, -0.36, -0.36, -0.36, -0.5, -0.36, -0.43, -0.43, -0.43, -0.43, -0.5, -0.43,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.5, -0.28, 0.5, 0.05, -0.06, 0.27, 0.05, 0.05, -0.28, -0.17, -0.17, 0.05, -0.39, -0.17, -0.5, 0.05, -0.39, -0.39, -0.28, -0.28, -0.17, -0.28, -0.17, -0.39, -0.17, -0.06, -0.28, -0.5, -0.39, -0.5,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: 0.1, -0.1, 0.4, 0.4, 0.5, 0.2, 0.3, -0.2, 0, 0.1, 0, 0.1, -0.1, -0.1, -0.3, 0.1, 0, -0.1, -0.1, -0.2, -0.1, -0.3, -0.3, -0.2, -0.2, -0.3, -0.4, -0.4, -0.5, -0.4,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.14, 0.5, 0.13, 0.4, 0.5, -0.23, -0.14, -0.23, 0.04, -0.23, -0.14, -0.05, 0.04, -0.05, -0.14, -0.32, 0.04, -0.14, -0.23, 0.13, -0.23, -0.14, -0.14, -0.14, -0.41, -0.32, -0.41, -0.41, -0.5, -0.41,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.1, 0.3, 0.1, 0.4, 0.4, 0.5, -0.2, 0.3, -0.3, -0.1, 0.1, -0.3, 0, -0.2, 0, 0.1, -0.1, 0, 0, 0, -0.2, -0.1, -0.3, -0.3, -0.5, -0.3, -0.5, -0.3, -0.5, -0.4,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.38, 0.37, 0.5, 0.37, 0.37, 0.25, 0.5, -0.13, 0, -0.38, 0.5, -0.38, 0.12, -0.13, 0, 0, -0.25, -0.38, 0, 0.12, -0.25, 0, -0.13, -0.38, 0.12, 0.12, 0, -0.5, -0.25, -0.38,  
-> output: 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 
--------------------------------------------------
-> input: -0.42, -0.42, -0.42, -0.25, -0.42, -0.25, -0.09, 0.16, 0.5, 0.08, -0.34, 0, -0.34, 0, -0.17, -0.09, 0.08, -0.17, 0.16, -0.25, -0.25, -0.17, 0, -0.5, -0.42, -0.5, -0.5, -0.42, -0.42, -0.5,  
-> output: -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 
--------------------------------------------------
-> input: -0.42, -0.42, -0.42, -0.25, -0.42, -0.17, -0.17, 0.16, 0.5, 0.08, -0.25, 0, -0.34, -0.09, -0.09, 0, 0, -0.17, 0.08, -0.17, -0.25, -0.17, 0, -0.5, -0.42, -0.5, -0.5, -0.42, -0.42, -0.5,  
-> output: -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 
--------------------------------------------------
-> input: -0.34, -0.34, -0.25, -0.34, -0.5, 0.5, 0.33, 0, 0.16, -0.09, -0.17, 0, 0, -0.09, 0, -0.25, -0.09, 0.08, -0.34, 0, -0.09, -0.09, -0.25, 0.16, -0.42, -0.17, -0.42, -0.42, -0.42, -0.42,  
-> output: -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 
--------------------------------------------------
-> input: -0.4, -0.5, -0.3, -0.4, -0.5, -0.5, -0.5, -0.1, -0.2, 0.4, 0.5, 0.1, 0, 0.1, 0, 0.1, 0.2, 0.2, 0.1, -0.1, -0.2, -0.2, -0.2, -0.3, -0.4, -0.5, -0.5, -0.4, -0.4, -0.5,  
-> output: -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 
--------------------------------------------------
-> input: -0.28, -0.39, -0.5, -0.5, -0.5, -0.5, -0.5, -0.39, -0.39, 0.27, 0.5, 0.27, 0.27, 0.16, 0.16, -0.06, -0.17, 0.16, -0.17, 0.05, 0.27, 0.38, -0.06, -0.17, -0.06, -0.17, -0.5, -0.39, -0.39, -0.5,  
-> output: -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 
--------------------------------------------------
-> input: -0.2, -0.4, -0.4, -0.4, -0.4, -0.4, -0.2, 0.2, 0.1, 0.1, 0.2, 0, 0.5, 0.1, 0.3, -0.3, 0.1, 0, -0.1, 0, 0.2, -0.1, -0.4, -0.5, -0.4, -0.4, -0.5, -0.4, -0.4, -0.5,  
-> output: -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 
--------------------------------------------------
-> input: -0.3, -0.3, -0.4, -0.3, -0.3, -0.5, -0.3, -0.3, 0, 0.5, 0.4, 0.5, 0.2, 0.3, -0.1, 0.2, 0.2, 0, 0.1, -0.1, 0, 0.2, -0.2, 0, 0.1, -0.1, -0.2, -0.4, -0.3, -0.4,  
-> output: -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 
--------------------------------------------------
-> input: -0.34, -0.42, -0.42, -0.5, -0.42, -0.42, -0.5, -0.42, -0.42, 0.16, 0.5, 0.16, 0.16, 0.08, -0.25, -0.09, -0.17, 0.08, -0.17, -0.17, -0.17, 0, -0.09, -0.25, -0.17, -0.25, -0.34, -0.34, -0.5, -0.5,  
-> output: -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 
--------------------------------------------------


I've also been playing around with the Neurons in the first and second layer. So Instead of having plain 30 Neurons in the first layer somehow 33 neurons work better. And the BipolarSigmoidFunction is set to 0.3. So the ActivationNetwork is like so:

new ActivationNetwork(
			new BipolarSigmoidFunction(.3f),
			30, // inputs in the network
			33, // first layer
			1); // second layer


Depending of how many input I have the network takes around 150.000 Epochs for a decent error value (around 0.01-0.02) but that might be because of too many inputs. Anyway I just wanted to post my temp solution here if anybody else has similar problems like me.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900