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 2012/10/09 12:06:41 UTC

svn commit: r1395938 - in /labs/yay/trunk/core/src/main/java/org/apache/yay: BasicElaborationUnit.java IdentityActivationFunction.java

Author: tommaso
Date: Tue Oct  9 10:06:41 2012
New Revision: 1395938

URL: http://svn.apache.org/viewvc?rev=1395938&view=rev
Log:
changing BasicElaborationUnit to support multiple inputs, adding IdentityActivationFunction

Added:
    labs/yay/trunk/core/src/main/java/org/apache/yay/IdentityActivationFunction.java   (with props)
Modified:
    labs/yay/trunk/core/src/main/java/org/apache/yay/BasicElaborationUnit.java

Modified: labs/yay/trunk/core/src/main/java/org/apache/yay/BasicElaborationUnit.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/core/src/main/java/org/apache/yay/BasicElaborationUnit.java?rev=1395938&r1=1395937&r2=1395938&view=diff
==============================================================================
--- labs/yay/trunk/core/src/main/java/org/apache/yay/BasicElaborationUnit.java (original)
+++ labs/yay/trunk/core/src/main/java/org/apache/yay/BasicElaborationUnit.java Tue Oct  9 10:06:41 2012
@@ -21,7 +21,7 @@ package org.apache.yay;
 /**
  * A node in a neural network
  */
-public class BasicElaborationUnit<T> {
+public abstract class BasicElaborationUnit<T> {
 
   private ActivationFunction<T> activationFunction;
 
@@ -29,7 +29,9 @@ public class BasicElaborationUnit<T> {
     this.activationFunction = activationFunction;
   }
 
-  public T elaborate(T input) {
-    return activationFunction.apply(input);
+  public T elaborate(T... inputs) {
+    return activationFunction.apply(combine(inputs));
   }
+
+  public abstract T combine(T... inputs);
 }

Added: labs/yay/trunk/core/src/main/java/org/apache/yay/IdentityActivationFunction.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/core/src/main/java/org/apache/yay/IdentityActivationFunction.java?rev=1395938&view=auto
==============================================================================
--- labs/yay/trunk/core/src/main/java/org/apache/yay/IdentityActivationFunction.java (added)
+++ labs/yay/trunk/core/src/main/java/org/apache/yay/IdentityActivationFunction.java Tue Oct  9 10:06:41 2012
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yay;
+
+/**
+ * An {@link ActivationFunction} which just replicates the signal without changing it
+ */
+public class IdentityActivationFunction<T> implements ActivationFunction<T> {
+
+  @Override
+  public T apply(T signal) {
+    return signal;
+  }
+
+}

Propchange: labs/yay/trunk/core/src/main/java/org/apache/yay/IdentityActivationFunction.java
------------------------------------------------------------------------------
    svn:eol-style = native



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