Author: tommaso
Date: Fri Jun 22 08:55:00 2012
New Revision: 1352809
URL: http://svn.apache.org/viewvc?rev=1352809&view=rev
Log:
adding (dummy) test for void learning strategy
Added:
labs/yay/trunk/core/src/test/java/org/apache/yay/VoidLearningStrategyTest.java
Added:
labs/yay/trunk/core/src/test/java/org/apache/yay/VoidLearningStrategyTest.java
URL:
http://svn.apache.org/viewvc/labs/yay/trunk/core/src/test/java/org/apache/yay/VoidLearningStrategyTest.java?rev=1352809&view=auto
==============================================================================
---
labs/yay/trunk/core/src/test/java/org/apache/yay/VoidLearningStrategyTest.java
(added)
+++
labs/yay/trunk/core/src/test/java/org/apache/yay/VoidLearningStrategyTest.java
Fri Jun 22 08:55:00 2012
@@ -0,0 +1,44 @@
+/*
+ * 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.LinkedList;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Testcase for {@link VoidLearningStrategy}
+ */
+public class VoidLearningStrategyTest {
+
+ @Test
+ public void testNoLearning() throws Exception {
+ VoidLearningStrategy<String, String> learningStrategy = new
VoidLearningStrategy<String, String>();
+ Collection<TrainingExample<String, String>> trainingExamples = new
LinkedList<TrainingExample<String, String>>();
+ WeightsMatrix[] weightsMatrixSet = new WeightsMatrix[1];
+ double[][] weights = {{1d, 2d,}, {2d, 4d}};
+ weightsMatrixSet[0] = new WeightsMatrix(weights);
+ WeightsMatrix[] learnedWeights =
learningStrategy.learnWeights(weightsMatrixSet,trainingExamples);
+ assertEquals(learnedWeights, weightsMatrixSet);
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]