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/08/07 11:06:13 UTC

svn commit: r1370150 - in /labs/yay/trunk/core/src/main/java/org/apache/yay: MaxSelectionFunction.java SelectionFunction.java

Author: tommaso
Date: Tue Aug  7 09:06:13 2012
New Revision: 1370150

URL: http://svn.apache.org/viewvc?rev=1370150&view=rev
Log:
adding selection function interface with default (max) implementation

Added:
    labs/yay/trunk/core/src/main/java/org/apache/yay/MaxSelectionFunction.java
    labs/yay/trunk/core/src/main/java/org/apache/yay/SelectionFunction.java

Added: labs/yay/trunk/core/src/main/java/org/apache/yay/MaxSelectionFunction.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/core/src/main/java/org/apache/yay/MaxSelectionFunction.java?rev=1370150&view=auto
==============================================================================
--- labs/yay/trunk/core/src/main/java/org/apache/yay/MaxSelectionFunction.java (added)
+++ labs/yay/trunk/core/src/main/java/org/apache/yay/MaxSelectionFunction.java Tue Aug  7 09:06:13 2012
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Selects the max value from a {@link Collection} of outputs
+ */
+public class MaxSelectionFunction implements SelectionFunction<Collection<Comparable>, Comparable> {
+
+    @Override
+    public Comparable selectOutput(Collection<Comparable> neuralNetworkOutput) {
+        return Collections.max(neuralNetworkOutput);
+    }
+}

Added: labs/yay/trunk/core/src/main/java/org/apache/yay/SelectionFunction.java
URL: http://svn.apache.org/viewvc/labs/yay/trunk/core/src/main/java/org/apache/yay/SelectionFunction.java?rev=1370150&view=auto
==============================================================================
--- labs/yay/trunk/core/src/main/java/org/apache/yay/SelectionFunction.java (added)
+++ labs/yay/trunk/core/src/main/java/org/apache/yay/SelectionFunction.java Tue Aug  7 09:06:13 2012
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+/**
+ * A function to apply on the raw output of a {@link NeuralNetwork} in order to
+ * transform it in a more convenient format / type
+ */
+public interface SelectionFunction<N, O> {
+
+  public O selectOutput(N neuralNetworkOutput);
+
+}



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