View Javadoc

1   package yawn.envs;
2   
3   import org.apache.commons.lang.builder.ToStringBuilder;
4   
5   import yawn.config.ValidationException;
6   import yawn.util.InputOutputPattern;
7   import yawn.util.Pattern;
8   
9   /***
10   * Specifies methods that should provide a way to interact with a test
11   * environment. In particular, it allows to read training and test data and to
12   * write predictions.
13   * 
14   * <p>$Id: Environment.java,v 1.5 2005/04/20 18:55:16 supermarti Exp $</p>
15   * 
16   * @author Luis Mart&iacute; (luis dot marti at uc3m dot es)
17   * @version $Revision: 1.5 $
18   */
19  public abstract class Environment {
20  
21      /***
22       * Returns the number of times the system will be run. Do not mistake the
23       * term "system run" with "epoch"
24       * 
25       * @return total number of system runs
26       */
27      public abstract int getNumberOfSystemRuns();
28  
29      public abstract void setNumberOfSystemRuns(int numberOfRuns);
30  
31      /***
32       * Reads a train file from the environment.
33       * 
34       * @param runNumber
35       *            the number of the current system run
36       * @return the training set as an array of <code>InputOutputPattern</code>
37       * @throws EnvironmentException
38       */
39      public abstract InputOutputPattern[] getTrainingDataset(int runNumber)
40              throws EnvironmentException;
41  
42      /***
43       * Reads a test dataset from the environment. The test set is a input-only
44       * file.
45       * 
46       * @param runNumber
47       *            the number of the current system run
48       * @return Test set
49       * @throws EnvironmentException
50       */
51      public abstract Pattern[] getTestDatasetInputs(int runNumber) throws EnvironmentException;
52  
53      public abstract void writeResults(Pattern[] results, int runNumber) throws EnvironmentException;
54  
55      public abstract void validate() throws ValidationException;
56  
57      public String toString() {
58          return ToStringBuilder.reflectionToString(this);
59      }
60  
61      public abstract int inputSize();
62  
63      public abstract int outputSize();
64  
65  }