hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1395607 - /hama/trunk/ml/src/main/java/org/apache/hama/ml/regression/GradientDescentBSP.java
Date Mon, 08 Oct 2012 15:17:51 GMT
Author: tommaso
Date: Mon Oct  8 15:17:50 2012
New Revision: 1395607

URL: http://svn.apache.org/viewvc?rev=1395607&view=rev
Log:
[HAMA-651] - fixed typos and constant abstractions

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=1395607&r1=1395606&r2=1395607&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 Mon
Oct  8 15:17:50 2012
@@ -38,6 +38,8 @@ public class GradientDescentBSP extends 
   private static final Logger log = LoggerFactory.getLogger(GradientDescentBSP.class);
   static final String INITIAL_THETA_VALUES = "initial.theta.values";
   static final String ALPHA = "alpha";
+  static final String THRESHOLD = "threshold";
+  static final String REGRESSION_MODEL_CLASS = "regression.model.class";
 
   private boolean master;
   private DoubleVector theta;
@@ -50,10 +52,10 @@ public class GradientDescentBSP extends 
   public void setup(BSPPeer<VectorWritable, DoubleWritable, VectorWritable, DoubleWritable,
VectorWritable> peer) throws IOException, SyncException, InterruptedException {
     master = peer.getPeerIndex() == peer.getNumPeers() / 2;
     cost = Integer.MAX_VALUE;
-    threshold = peer.getConfiguration().getFloat("threashold", 0.01f);
+    threshold = peer.getConfiguration().getFloat(THRESHOLD, 0.01f);
     alpha = peer.getConfiguration().getFloat(ALPHA, 0.3f);
     try {
-      regressionModel = ((Class<? extends RegressionModel>)peer.getConfiguration().getClass("regression.model",
LinearRegressionModel.class)).newInstance();
+      regressionModel = ((Class<? extends RegressionModel>)peer.getConfiguration().getClass(REGRESSION_MODEL_CLASS,
LinearRegressionModel.class)).newInstance();
     } catch (Exception e) {
       throw new IOException(e);
     }



Mime
View raw message