You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by to...@apache.org on 2013/06/19 13:44:56 UTC
svn commit: r1494566 - in /labs/yay/trunk/core/src:
main/java/org/apache/yay/core/BackPropagationLearningStrategy.java
test/java/org/apache/yay/core/BackPropagationLearningStrategyTest.java
Author: tommaso
Date: Wed Jun 19 11:44:55 2013
New Revision: 1494566
URL: http://svn.apache.org/r1494566
Log:
backprop test now using 0.5M random inputs
Modified:
labs/yay/trunk/core/src/main/java/org/apache/yay/core/BackPropagationLearningStrategy.java
labs/yay/trunk/core/src/test/java/org/apache/yay/core/BackPropagationLearningStrategyTest.java
Modified: labs/yay/trunk/core/src/main/java/org/apache/yay/core/BackPropagationLearningStrategy.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/core/src/main/java/org/apache/yay/core/BackPropagationLearningStrategy.java?rev=1494566&r1=1494565&r2=1494566&view=diff
==============================================================================
--- labs/yay/trunk/core/src/main/java/org/apache/yay/core/BackPropagationLearningStrategy.java (original)
+++ labs/yay/trunk/core/src/main/java/org/apache/yay/core/BackPropagationLearningStrategy.java Wed Jun 19 11:44:55 2013
@@ -80,7 +80,7 @@ public class BackPropagationLearningStra
if (newCost > cost) {
throw new RuntimeException("failed to converge at iteration " + iterations + " with alpha "+ alpha +" : cost going from " + cost + " to " + newCost);
} else if (cost == newCost || newCost < threshold || iterations > MAX_ITERATIONS) {
- System.out.println("successfully converged after " + iterations + " iterations with cost " + newCost + " and parameters " + Arrays.toString(hypothesis.getParameters()));
+ System.out.println("successfully converged with alpha " + alpha + " after " + iterations + " iterations with cost " + newCost + " and parameters " + Arrays.toString(hypothesis.getParameters()));
break;
}
Modified: labs/yay/trunk/core/src/test/java/org/apache/yay/core/BackPropagationLearningStrategyTest.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/core/src/test/java/org/apache/yay/core/BackPropagationLearningStrategyTest.java?rev=1494566&r1=1494565&r2=1494566&view=diff
==============================================================================
--- labs/yay/trunk/core/src/test/java/org/apache/yay/core/BackPropagationLearningStrategyTest.java (original)
+++ labs/yay/trunk/core/src/test/java/org/apache/yay/core/BackPropagationLearningStrategyTest.java Wed Jun 19 11:44:55 2013
@@ -60,10 +60,10 @@ public class BackPropagationLearningStra
}
@Test
- public void testLearningWithRandomSamplesAndRandomWeightsAndParams() throws Exception {
+ public void testBigLearningWithRandomParameters() throws Exception {
PredictionStrategy<Double, Double> predictionStrategy = new FeedForwardStrategy(new SigmoidFunction());
BackPropagationLearningStrategy backPropagationLearningStrategy =
- new BackPropagationLearningStrategy(0.1d, 0.001d, predictionStrategy, new LogisticRegressionCostFunction(Math.random()));
+ new BackPropagationLearningStrategy(Math.random(), 0.00001d, predictionStrategy, new LogisticRegressionCostFunction(Math.random()));
// 3 input units, 3 hidden units, 4 hidden units, 1 output unit
RealMatrix[] initialWeights = new RealMatrix[3];
@@ -71,7 +71,7 @@ public class BackPropagationLearningStra
initialWeights[1] = new Array2DRowRealMatrix(new double[][]{{0d, 0d, 0d, 0d}, {1d, Math.random(), Math.random(), Math.random()}, {1d, Math.random(), Math.random(), Math.random()}, {1d, Math.random(), Math.random(), Math.random()}});
initialWeights[2] = new Array2DRowRealMatrix(new double[][]{{1d,Math.random(), Math.random(), Math.random()}});
- Collection<TrainingExample<Double, Double>> samples = createSamples(50, 2);
+ Collection<TrainingExample<Double, Double>> samples = createSamples(500000, 2);
TrainingSet<Double, Double> trainingSet = new TrainingSet<Double, Double>(samples);
RealMatrix[] learntWeights = backPropagationLearningStrategy.learnWeights(initialWeights, trainingSet);
assertNotNull(learntWeights);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org