You need to reopen the input on every peer in your case ;) To get M you can loop over the data in setup and then reopen again and exchange the numbers via messaging.
GL! 2012/10/12 <[email protected]> > Author: tommaso > Date: Fri Oct 12 06:09:56 2012 > New Revision: 1397446 > > URL: http://svn.apache.org/viewvc?rev=1397446&view=rev > Log: > [HAMA-651] - added a couple of TODOs > > Modified: > > hama/trunk/ml/src/main/java/org/apache/hama/ml/regression/GradientDescentBSP.java > > Modified: > hama/trunk/ml/src/main/java/org/apache/hama/ml/regression/GradientDescentBSP.java > URL: > http://svn.apache.org/viewvc/hama/trunk/ml/src/main/java/org/apache/hama/ml/regression/GradientDescentBSP.java?rev=1397446&r1=1397445&r2=1397446&view=diff > > ============================================================================== > --- > hama/trunk/ml/src/main/java/org/apache/hama/ml/regression/GradientDescentBSP.java > (original) > +++ > hama/trunk/ml/src/main/java/org/apache/hama/ml/regression/GradientDescentBSP.java > Fri Oct 12 06:09:56 2012 > @@ -104,7 +104,7 @@ public class GradientDescentBSP extends > numRead += costResult.getVector().get(1); > } > > - totalCost /= numRead; > + totalCost /= numRead; // TODO : remove this and incorporate the 1/m > element in RegressionModel#calculateCostForItem > > if (cost - totalCost < 0) { > throw new RuntimeException("gradient descent failed to converge > with alpha " + alpha); > @@ -123,7 +123,9 @@ public class GradientDescentBSP extends > > peer.sync(); > > - peer.reopenInput(); > + if (master) { // TODO : check if this has to be done only by the > master > + peer.reopenInput(); > + } > > double[] thetaDelta = new double[theta.getLength()]; > > > >
