yawn.envs.plaintext
Class PlainTextEnvironment

java.lang.Object
  extended by yawn.envs.Environment
      extended by yawn.envs.plaintext.PlainTextEnvironment

public class PlainTextEnvironment
extends Environment

This is part of the yawn project. Created on 28-nov-2003 at 1:52:19. $Id: PlainTextEnvironment.java,v 1.5 2005/04/07 17:28:27 supermarti Exp $

Version:
$Revision: 1.5 $
Author:
Luis Martí (luis dot marti at uc3m dot es)

Field Summary
protected  java.lang.String dataFileName
           
protected static java.lang.String ELEMENT_SEPARATOR_SPACE
           
protected  java.lang.String elementSeparator
           
protected  int inputSize
           
protected  int numberOfSystemRuns
           
protected  int outputSize
           
protected  boolean overwriteResults
           
protected  java.lang.String resultsFileName
           
protected  InputOutputPattern[][] testSet
           
protected  InputOutputPattern[][] trainSet
           
protected  double trainToTestRatio
           
 
Constructor Summary
PlainTextEnvironment()
           
 
Method Summary
 java.lang.String getDataFileName()
           
 java.lang.String getElementSeparator()
           
 int getInputSize()
           
 int getNumberOfSystemRuns()
          Returns the number of times the system will be run.
 int getOutputSize()
           
 java.lang.String getResultsFileName()
           
 Pattern[] getTestDatasetInputs(int runNumber)
          Reads a test dataset from the environment.
 InputOutputPattern[] getTrainingDataset(int runNumber)
          Reads a train file from the environment.
 double getTrainToTestRatio()
           
protected  void init()
           
 int inputSize()
           
 boolean isOverwriteResults()
           
protected  InputOutputPattern[] loadInputOutputFile(java.lang.String fileName)
           
 int outputSize()
           
 void setDataFileName(java.lang.String dataFileName)
           
 void setElementSeparator(java.lang.String elementSeparator)
           
 void setInputSize(int inputSize)
           
 void setNumberOfSystemRuns(int numberOfSystemRuns)
           
 void setOutputSize(int outputSize)
           
 void setOverwriteResults(boolean overwriteResults)
           
 void setResultsFileName(java.lang.String resultsFileName)
           
 void setTrainToTestRatio(double trainToTestRatio)
           
 void validate()
           
 void writeResults(Pattern[] results, int runNumber)
          Writes the results to a an ascii file.
 
Methods inherited from class yawn.envs.Environment
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ELEMENT_SEPARATOR_SPACE

protected static final java.lang.String ELEMENT_SEPARATOR_SPACE
See Also:
Constant Field Values

dataFileName

protected java.lang.String dataFileName

resultsFileName

protected java.lang.String resultsFileName

overwriteResults

protected boolean overwriteResults

elementSeparator

protected java.lang.String elementSeparator

inputSize

protected int inputSize

numberOfSystemRuns

protected int numberOfSystemRuns

outputSize

protected int outputSize

testSet

protected InputOutputPattern[][] testSet

trainSet

protected InputOutputPattern[][] trainSet

trainToTestRatio

protected double trainToTestRatio
Constructor Detail

PlainTextEnvironment

public PlainTextEnvironment()
Method Detail

isOverwriteResults

public boolean isOverwriteResults()
Returns:
Returns the overwriteResults.

setOverwriteResults

public void setOverwriteResults(boolean overwriteResults)
Parameters:
overwriteResults - The overwriteResults to set.

getResultsFileName

public java.lang.String getResultsFileName()
Returns:
Returns the resultsFileName.

setResultsFileName

public void setResultsFileName(java.lang.String resultsFileName)
Parameters:
resultsFileName - The resultsFileName to set.

getDataFileName

public java.lang.String getDataFileName()
Returns:
Returns the dataFileName.

getElementSeparator

public java.lang.String getElementSeparator()

getInputSize

public int getInputSize()

getNumberOfSystemRuns

public int getNumberOfSystemRuns()
Description copied from class: Environment
Returns the number of times the system will be run. Do not mistake the term "system run" with "epoch"

Specified by:
getNumberOfSystemRuns in class Environment
Returns:
Returns the numberOfSystemRuns.

getOutputSize

public int getOutputSize()

getTestDatasetInputs

public Pattern[] getTestDatasetInputs(int runNumber)
                               throws EnvironmentException
Description copied from class: Environment
Reads a test dataset from the environment. The test set is a input-only file.

Specified by:
getTestDatasetInputs in class Environment
Parameters:
runNumber - the number of the current system run
Returns:
Test set
Throws:
EnvironmentException
See Also:
Environment.getTestDatasetInputs(int)

getTrainingDataset

public InputOutputPattern[] getTrainingDataset(int runNumber)
                                        throws EnvironmentException
Description copied from class: Environment
Reads a train file from the environment.

Specified by:
getTrainingDataset in class Environment
Parameters:
runNumber - the number of the current system run
Returns:
the training set as an array of InputOutputPattern
Throws:
EnvironmentException
See Also:
Environment.getTrainingDataset(int)

getTrainToTestRatio

public double getTrainToTestRatio()
Returns:
Returns the trainToTestRatio.

inputSize

public int inputSize()
Specified by:
inputSize in class Environment

outputSize

public int outputSize()
Specified by:
outputSize in class Environment

setDataFileName

public void setDataFileName(java.lang.String dataFileName)
Parameters:
dataFileName - The dataFileName to set.

setElementSeparator

public void setElementSeparator(java.lang.String elementSeparator)

setInputSize

public void setInputSize(int inputSize)

setNumberOfSystemRuns

public void setNumberOfSystemRuns(int numberOfSystemRuns)
Specified by:
setNumberOfSystemRuns in class Environment
Parameters:
numberOfSystemRuns - The numberOfSystemRuns to set.

setOutputSize

public void setOutputSize(int outputSize)

setTrainToTestRatio

public void setTrainToTestRatio(double trainToTestRatio)
Parameters:
trainToTestRatio - The trainToTestRatio to set.

validate

public void validate()
              throws ValidationException
Specified by:
validate in class Environment
Throws:
ValidationException

writeResults

public void writeResults(Pattern[] results,
                         int runNumber)
                  throws EnvironmentException
Writes the results to a an ascii file.

Specified by:
writeResults in class Environment
Throws:
EnvironmentException
See Also:
getElementSeparator()

init

protected void init()
             throws EnvironmentException
Throws:
EnvironmentException

loadInputOutputFile

protected InputOutputPattern[] loadInputOutputFile(java.lang.String fileName)
                                            throws EnvironmentException
Throws:
EnvironmentException


Copyright © 2003-2005 GIAA, Universidad Carlos III de Madrid. All Rights Reserved.