labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1707888 - in /labs/yay/trunk: api/src/main/java/org/apache/yay/ core/src/main/java/org/apache/yay/core/ core/src/test/java/org/apache/yay/core/
Date Sat, 10 Oct 2015 15:38:53 GMT
Author: tommaso
Date: Sat Oct 10 15:38:53 2015
New Revision: 1707888

URL: http://svn.apache.org/viewvc?rev=1707888&view=rev
Log:
minor fixes

Modified:
    labs/yay/trunk/api/src/main/java/org/apache/yay/CreationException.java
    labs/yay/trunk/api/src/main/java/org/apache/yay/Neuron.java
    labs/yay/trunk/core/src/main/java/org/apache/yay/core/FeedForwardStrategy.java
    labs/yay/trunk/core/src/main/java/org/apache/yay/core/LogisticRegressionCostFunction.java
    labs/yay/trunk/core/src/main/java/org/apache/yay/core/NeuralNetworkFactory.java
    labs/yay/trunk/core/src/main/java/org/apache/yay/core/SoftmaxActivationFunction.java
    labs/yay/trunk/core/src/test/java/org/apache/yay/core/NeuralNetworkIntegrationTest.java

Modified: labs/yay/trunk/api/src/main/java/org/apache/yay/CreationException.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/api/src/main/java/org/apache/yay/CreationException.java?rev=1707888&r1=1707887&r2=1707888&view=diff
==============================================================================
--- labs/yay/trunk/api/src/main/java/org/apache/yay/CreationException.java (original)
+++ labs/yay/trunk/api/src/main/java/org/apache/yay/CreationException.java Sat Oct 10 15:38:53
2015
@@ -22,7 +22,7 @@ package org.apache.yay;
  * Exception thrown when an error occurs while creating a neural network
  */
 @SuppressWarnings("serial")
-public class CreationException extends Exception {
+class CreationException extends Exception {
   public CreationException(Exception e) {
     super(e);
   }

Modified: labs/yay/trunk/api/src/main/java/org/apache/yay/Neuron.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/api/src/main/java/org/apache/yay/Neuron.java?rev=1707888&r1=1707887&r2=1707888&view=diff
==============================================================================
--- labs/yay/trunk/api/src/main/java/org/apache/yay/Neuron.java (original)
+++ labs/yay/trunk/api/src/main/java/org/apache/yay/Neuron.java Sat Oct 10 15:38:53 2015
@@ -32,7 +32,7 @@ public abstract class Neuron<T> {
 
   protected ActivationFunction<T> activationFunction;
 
-  public Neuron(ActivationFunction<T> activationFunction, double... weights) {
+  protected Neuron(ActivationFunction<T> activationFunction, double... weights) {
     this.activationFunction = activationFunction;
     this.weights = weights;
     this.matrix = MatrixUtils.createRowRealMatrix(weights);

Modified: labs/yay/trunk/core/src/main/java/org/apache/yay/core/FeedForwardStrategy.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/core/src/main/java/org/apache/yay/core/FeedForwardStrategy.java?rev=1707888&r1=1707887&r2=1707888&view=diff
==============================================================================
--- labs/yay/trunk/core/src/main/java/org/apache/yay/core/FeedForwardStrategy.java (original)
+++ labs/yay/trunk/core/src/main/java/org/apache/yay/core/FeedForwardStrategy.java Sat Oct
10 15:38:53 2015
@@ -88,10 +88,7 @@ public class FeedForwardStrategy impleme
 
         @Override
         public double visit(int row, int column, double value) {
-          final RealMatrix rowMatrix = cm.getRowMatrix(row);
-          final RealMatrix columnMatrix = cm.getColumnMatrix(column);
-          Double newValue = af.apply(cm, value);
-          return newValue;
+          return af.apply(cm, value);
         }
 
         @Override

Modified: labs/yay/trunk/core/src/main/java/org/apache/yay/core/LogisticRegressionCostFunction.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/core/src/main/java/org/apache/yay/core/LogisticRegressionCostFunction.java?rev=1707888&r1=1707887&r2=1707888&view=diff
==============================================================================
--- labs/yay/trunk/core/src/main/java/org/apache/yay/core/LogisticRegressionCostFunction.java
(original)
+++ labs/yay/trunk/core/src/main/java/org/apache/yay/core/LogisticRegressionCostFunction.java
Sat Oct 10 15:38:53 2015
@@ -19,7 +19,6 @@
 package org.apache.yay.core;
 
 import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.yay.CreationException;
 import org.apache.yay.Hypothesis;
 import org.apache.yay.NeuralNetworkCostFunction;
 import org.apache.yay.PredictionException;

Modified: labs/yay/trunk/core/src/main/java/org/apache/yay/core/NeuralNetworkFactory.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/core/src/main/java/org/apache/yay/core/NeuralNetworkFactory.java?rev=1707888&r1=1707887&r2=1707888&view=diff
==============================================================================
--- labs/yay/trunk/core/src/main/java/org/apache/yay/core/NeuralNetworkFactory.java (original)
+++ labs/yay/trunk/core/src/main/java/org/apache/yay/core/NeuralNetworkFactory.java Sat Oct
10 15:38:53 2015
@@ -20,7 +20,6 @@ package org.apache.yay.core;
 
 import java.util.Collection;
 import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.yay.CreationException;
 import org.apache.yay.Input;
 import org.apache.yay.LearningException;
 import org.apache.yay.LearningStrategy;
@@ -34,7 +33,7 @@ import org.apache.yay.core.utils.Convers
 /**
  * Factory class for creating {@link org.apache.yay.NeuralNetwork}s
  */
-public class NeuralNetworkFactory {
+class NeuralNetworkFactory {
 
   /**
    * creates a neural network via a supervised learning method, given a training set, the
initial set of layers defined

Modified: labs/yay/trunk/core/src/main/java/org/apache/yay/core/SoftmaxActivationFunction.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/core/src/main/java/org/apache/yay/core/SoftmaxActivationFunction.java?rev=1707888&r1=1707887&r2=1707888&view=diff
==============================================================================
--- labs/yay/trunk/core/src/main/java/org/apache/yay/core/SoftmaxActivationFunction.java (original)
+++ labs/yay/trunk/core/src/main/java/org/apache/yay/core/SoftmaxActivationFunction.java Sat
Oct 10 15:38:53 2015
@@ -36,7 +36,6 @@ public class SoftmaxActivationFunction i
                 den += Math.exp(row1[j]);
             }
         }
-      double v = num / den;
-      return v;
+        return num / den;
     }
 }

Modified: labs/yay/trunk/core/src/test/java/org/apache/yay/core/NeuralNetworkIntegrationTest.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/core/src/test/java/org/apache/yay/core/NeuralNetworkIntegrationTest.java?rev=1707888&r1=1707887&r2=1707888&view=diff
==============================================================================
--- labs/yay/trunk/core/src/test/java/org/apache/yay/core/NeuralNetworkIntegrationTest.java
(original)
+++ labs/yay/trunk/core/src/test/java/org/apache/yay/core/NeuralNetworkIntegrationTest.java
Sat Oct 10 15:38:53 2015
@@ -22,7 +22,6 @@ import org.apache.commons.math3.linear.A
 import org.apache.commons.math3.linear.RealMatrix;
 import org.apache.commons.math3.ml.distance.CanberraDistance;
 import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.ml.distance.EuclideanDistance;
 import org.apache.yay.*;
 import org.apache.yay.core.utils.ExamplesFactory;
 import org.junit.Test;
@@ -99,8 +98,7 @@ public class NeuralNetworkIntegrationTes
     assertEquals(Double.valueOf(0.9975273768433653d), prdictedValue);
   }
 
-  private NeuralNetwork createNN(RealMatrix[] realMatrixes, LearningStrategy<Double, Double>
learningStrategy)
-          throws CreationException {
+  private NeuralNetwork createNN(RealMatrix[] realMatrixes, LearningStrategy<Double, Double>
learningStrategy) {
     return NeuralNetworkFactory.create(realMatrixes, learningStrategy,
             new FeedForwardStrategy(new SigmoidFunction()));
   }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message