1
2
3
4
5
6
7 package yawn.nn;
8
9 import junit.framework.TestCase;
10
11 import org.apache.commons.lang.builder.ToStringBuilder;
12 import org.apache.commons.logging.Log;
13 import org.apache.commons.logging.LogFactory;
14
15 import yawn.config.NeuralNetworkConfig;
16 import yawn.envs.synthetic.SyntheticDataEnvironment;
17 import yawn.util.InputOutputPattern;
18 import yawn.util.Pattern;
19
20 /***
21 * This is yawn.nn.AbstractNeuralNetworkTest, part of the yawn project.
22 *
23 * <p>$Id: AbstractNeuralNetworkTest.java,v 1.10 2005/05/09 11:04:54 supermarti Exp $</p>
24 *
25 * @author Luis Martí (luis dot marti at uc3m dot es)
26 * @version $Revision: 1.10 $
27 */
28 public abstract class AbstractNeuralNetworkTest extends TestCase {
29 private static final Log log = LogFactory.getLog(AbstractNeuralNetworkTest.class);
30
31 /***
32 *
33 */
34 protected SyntheticDataEnvironment env;
35
36 /***
37 *
38 */
39 protected NeuralNetworkConfig conf;
40
41 /***
42 *
43 */
44 protected InputOutputPattern[] trainSet;
45
46 /***
47 *
48 * @uml.property name="testSet"
49 * @uml.associationEnd multiplicity="(0 -1)"
50 */
51 protected Pattern[] testSet;
52
53 /***
54 *
55 * @uml.property name="testSetActuals"
56 * @uml.associationEnd multiplicity="(0 -1)"
57 */
58 protected Pattern[] testSetActuals;
59
60 protected void setUp() throws Exception {
61 super.setUp();
62
63 env = createEnvironment();
64 env.validate();
65
66 trainSet = env.getTrainingDataset(0);
67 testSet = env.getTestDatasetInputs(0);
68 testSetActuals = env.getTestExpectedOutputsSet(0);
69
70 conf = createConfig();
71
72 conf.setEnvironment(env);
73 conf.validate();
74 log.info("Testing `" + conf.getBindedNetworkClass() + "' neural network class.");
75 log.debug(ToStringBuilder.reflectionToString(conf));
76 }
77
78 protected abstract SyntheticDataEnvironment createEnvironment();
79
80 protected abstract NeuralNetworkConfig createConfig();
81
82 public abstract void testTrain();
83
84
85
86
87
88
89
90
91
92 }