freedelta - 2010-04-14 20:05:00

I've got this question that I couldn't answer through email, so I am posting it here:

QUESTION:

========

I just tried your Back Propagation Scale class from PHP Classes, and I found it very interesting, but I have a problem with it. In your Run function the 2nd input parameter is the testDataX array containing the test datas, but as I inspected, this information you never use to calculate anything, but for to write the result table.

This is important for me, because I tried to extend your class with a new function, which can makes a calculation with a previously trained network.

At the first time I thought, that it would be enough, if I extract your Run function’s end (after the network’s backpropagation) to my new function with a testData array.

But I have failed, the calculation’s result is always the same: the first result elements from the training datas. For example, if I first time train the network with the multiplication matrix (as in your original class), and I give some test data to my function, the results I got is _independent_ from the input data, always 1, 2, 3, etc… After some hours of debug I cannot find, why L

Can you please help me?

Here is my function:

public function Calculate($testDataX) {

$this->NumPattern=count($testDataX);

$this->vectorOutput = array();

for ($i = 0; $i < $this->NumPattern; $i++ )

{

$this->ffwd($testDataX[$i]);

$this->vectorOutput[]=(double)$this->Out(0);

}

$out=$this->unscaleOutput($this->vectorOutput);

for($col=1;$col<$this->NumInput;$col++)

{

echo "Input$col\t";

}

echo "Predicted \n";

for ($i = 0 ; $i < $this->NumPattern; $i++ )

{

for($j=0;$j<$this->NumInput-1;$j++)

{

echo " ".$testDataX[$i][$j]." \t\t";

}

echo " " .abs($out[$i])."\n";

}

}

And the call:

$bp->Calculate( array( array(3,5), array(4,7), array(7,4) ) );

The answers is always (about) 1, 2, 3, independently the input array’s values…

Thank You and Best Regards:

Norbert

ANSWER:

======

I will try to answer to these questions.

The testDataX array, it is used to do some calculation it does the fast forwarding in the network, whereas the data array it is used to do the back propagation, in your function Calculate where do you train your data?

It seems that you are fast forwarding data that hasn't been previously back propagated.

I hope this help.