Collection<ParameterVectorUpdateable> masterUpdates) {
int x = 0;
// gets recomputed each time
RegressionStatistics regStats = new RegressionStatistics();
// reset
boolean iterationComplete = true;
double SSyy_partial_sum = 0;
double SSE_partial_sum = 0;
this.global_parameter_vector.parameter_vector = new DenseMatrix(1, this.FeatureVectorSize);
float avg_err = 0;
long totalBatchesTimeMS = 0;
for (ParameterVectorUpdateable i : workerUpdates) {
totalBatchesTimeMS += i.get().batchTimeMS;
// if any worker is not done with hte iteration, trip the flag
if (i.get().IterationComplete == 0 ) {
iterationComplete = false;
}
avg_err += i.get().AvgError;
iteration_count = i.get().CurrentIteration;
if ( 0 == i.get().CurrentIteration ) {
this.y_sum += i.get().y_partial_sum;
this.total_record_count += i.get().TrainedRecords;
} else {
SSE_partial_sum += i.get().SSE_partial_sum;
SSyy_partial_sum += i.get().SSyy_partial_sum;
}
x++;
this.global_parameter_vector.AccumulateVector(i.get().parameter_vector.viewRow(0));
}
long avgBatchSpeedMS = totalBatchesTimeMS / workerUpdates.size();
System.out.println( "\n[Master] ----- Iteration " + this.iteration_count + " -------" );
System.out.println( "> Workers: " + workerUpdates.size() + " ");
System.out.println( "> Avg Batch Scan Time: " + avgBatchSpeedMS + " ms");
if ( iteration_count == 0 ) {
// we want to cache this for later
regStats.AddPartialSumForY(this.y_sum, this.total_record_count);
this.global_parameter_vector.y_avg = regStats.ComputeYAvg();
this.y_avg = regStats.ComputeYAvg();
System.out.println(""
+ "> Computed Y Average: "
+ this.global_parameter_vector.y_avg );
} else {
regStats.AccumulateSSEPartialSum(SSE_partial_sum);
regStats.AccumulateSSyyPartialSum(SSyy_partial_sum);
double r_squared = regStats.CalculateRSquared();
System.out.println( "> " + x + " R-Squared: " + r_squared );
}