edu.duke.cs.banjo.data.observations
Class ObservationsAsArray

java.lang.Object
  extended byedu.duke.cs.banjo.data.observations.Observations
      extended byedu.duke.cs.banjo.data.observations.ObservationsAsArray
All Implemented Interfaces:
ObservationsI

public class ObservationsAsArray
extends Observations

Loads the observation data necessary for the search.

Details:
- Important: The Evaluator class uses the internal representation of the observations for performance, thus breaking encapsulation.
- Implementation of a data set, using a simple matrix of
    n rows of observationDataPoints
        by
    m columns of variables (nodes)

Change History:
Based on Banjo 1.0 Observations class, created on Mar 4, 2004

4/1/2004 hjs Change data type for external access to int
7/7/2004 hjs Change the internal representation from Char to Integer
9/14/2005 (v1.0.4) hjs Changes to properly handle discretization of multiple observation files
11/28/2005 (v1.0.5) hjs Correction to interval discretization
10/25/2005 (v2.0) hjs Eliminate the references to the (never supported) "related observations" code. (This was old code in desperate need of cleanup.)
10/28/2005 (v2.0) hjs Add additional field for access to the overall maximum value that the variables can assume.
7/11/2006 (v2.0) hjs Implement more memory efficient storage of observations, using 1-dim arrays instead of matrices (multi-dim. arrays). This class and the corresponding ObservationsAsMatrix class will be combined into a common hierarchy, so code common to both can be pulled out.
3/4/2008 (v2.2) hjs Pull out JZOOWildCardFilter into separate class.

Author:
Jurgen Sladeczek (hjs)
For the latest info, please visit www.cs.duke.edu.

Field Summary
protected  int dimLags
           
protected  int dimObservations
           
protected  int dimVariables
           
 int[] observationDataPointsCompact
           
protected  int offsetLags
           
protected  int offsetObservations
           
protected  int offsetVariables
           
 
Fields inherited from class edu.duke.cs.banjo.data.observations.Observations
combinedObservationDataPointsAsLoaded, combinedPreprocessedObservationsAsLoaded, maxMarkovLag, maxValue, maxValueCount, minMarkovLag, numberOfObservationsFiles, observationCount, observationRowCount, observedObservationCount, preprocessedObservationsWithFileInfo, processData, specifiedObservationCount, varCount, variableNames
 
Constructor Summary
ObservationsAsArray(Settings _processData)
          ObservationsAsMatrix constructor.
 
Method Summary
protected  void combinePreprocessedObservations(PreprocessedObservations[] _preprocessedObservations)
          Combines the loaded observations into a single large array.
 void computeMaxValueCounts()
          Computes the maximum values for all the variables in the data set given by the current observations.
 int getMaxValueCount()
          Get the maximum value that any variable can assume.
 int getMaxValueCount(int _nodeID)
          Get the maximum value that a specified variable can assume.
 int getObservationCount()
           
 int getObservationRowCount()
           
 int getObservationValue(int _observationRow, int _variableID, int _MarkovLag)
           
 PreprocessedObservations[] getPreprocessedObservationsWithFileInfo()
           
 java.lang.String getValueCountList()
           
 int getVarCount()
           
 java.lang.String[] getVariableNames()
           
 void loadData(Settings _processData)
          Loads the data from the user-specified observations files.
 void prepareData()
          Prepares the observations by applying an (optional) discretization.
 void releaseStagingData()
          Releases the data structures used for storing the original "raw" data (as loaded from file in String format).
 void setObservationDataPoints(int[] _observationsCompact)
           
 void setObservationValue(int _observationIndex, int _variableIndex, int _MarkovLagIndex, int _observationValue)
           
 void setVariableNames(java.lang.String[] _variableNames)
           
 java.lang.String toString()
           
private  boolean validateRequiredData()
          Validates the settings values required for loading the observations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

observationDataPointsCompact

public int[] observationDataPointsCompact

dimObservations

protected final int dimObservations

dimVariables

protected final int dimVariables

dimLags

protected final int dimLags

offsetObservations

protected final int offsetObservations

offsetVariables

protected final int offsetVariables

offsetLags

protected final int offsetLags
Constructor Detail

ObservationsAsArray

public ObservationsAsArray(Settings _processData)
                    throws java.lang.Exception
ObservationsAsMatrix constructor.

Parameters:
_processData - The settings that define the search process.
Method Detail

validateRequiredData

private boolean validateRequiredData()
                              throws java.lang.Exception
Validates the settings values required for loading the observations.

Returns:
Returns the boolean flag that indicates whether a crucial setting could not be validated.
Throws:
java.lang.Exception

loadData

public void loadData(Settings _processData)
              throws java.lang.Exception
Loads the data from the user-specified observations files.

Parameters:
_processData - The settings that define the search process.
Throws:
java.lang.Exception

combinePreprocessedObservations

protected void combinePreprocessedObservations(PreprocessedObservations[] _preprocessedObservations)
                                        throws java.lang.Exception
Combines the loaded observations into a single large array.

Parameters:
_preprocessedObservations - An array of PreprocessedObservations, each obtained, e.g., from a file.
Throws:
java.lang.Exception

prepareData

public void prepareData()
                 throws java.lang.Exception
Prepares the observations by applying an (optional) discretization.

Throws:
java.lang.Exception

getMaxValueCount

public int getMaxValueCount(int _nodeID)
Get the maximum value that a specified variable can assume.

Returns:
The maximum value assumed by the specified variable.

getMaxValueCount

public int getMaxValueCount()
Get the maximum value that any variable can assume.

Returns:
The maximum value assumed by any variable.

computeMaxValueCounts

public void computeMaxValueCounts()
                           throws java.lang.Exception
Computes the maximum values for all the variables in the data set given by the current observations.

Throws:
java.lang.Exception

toString

public java.lang.String toString()

setObservationValue

public void setObservationValue(int _observationIndex,
                                int _variableIndex,
                                int _MarkovLagIndex,
                                int _observationValue)

getObservationValue

public int getObservationValue(int _observationRow,
                               int _variableID,
                               int _MarkovLag)

getObservationRowCount

public final int getObservationRowCount()
Returns:
Returns the observationRowCount.

setObservationDataPoints

public void setObservationDataPoints(int[] _observationsCompact)
Parameters:
_observationsCompact - The observationDataPoints to set.

getVarCount

public final int getVarCount()
Returns:
Returns the varCount.

getValueCountList

public java.lang.String getValueCountList()

getObservationCount

public int getObservationCount()
Returns:
Returns the observationCount.

getPreprocessedObservationsWithFileInfo

public PreprocessedObservations[] getPreprocessedObservationsWithFileInfo()
Returns:
Returns the preprocessedObservationsWithFileInfo.

releaseStagingData

public void releaseStagingData()
Releases the data structures used for storing the original "raw" data (as loaded from file in String format).


getVariableNames

public java.lang.String[] getVariableNames()
Returns:
Returns the variableNames.

setVariableNames

public void setVariableNames(java.lang.String[] _variableNames)
Parameters:
_variableNames - The variableNames to set.