PHP Classes

Extending Backpropagation Scale

Recommend this page to a friend!

      Back Propagation Scale  >  All threads  >  Extending Backpropagation Scale  >  (Un) Subscribe thread alerts  
Subject:Extending Backpropagation Scale
Summary:Answer to a question
Date:2010-04-14 20:05:00
Update:2013-06-22 18:08:26

  1. Extending Backpropagation Scale   Reply   Report abuse  
Picture of freedelta 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:

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->vectorOutput = array();

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








echo "Input$col\t";


echo "Predicted \n";

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




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:


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.

  2. Re: Extending Backpropagation Scale   Reply   Report abuse  
Picture of kb kb - 2013-06-22 18:08:26 - In reply to message 1 from freedelta
i have the same issue can u plz guide me how can i make predictions for test data set, i want to train the network on training data and then use test data to make predictions