All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sim.data.Data

java.lang.Object
   |
   +----sim.data.Data

public abstract class Data
extends Object
implements Watchable, Parsable
a Data object represents a set of pairs of input/output vectors, suitable for use with supervised learning. It might contain an array of numbers, a function that generates them randomly, or a function that reads them from a file. All data objects should extend Data.

This code is (c) 1996 Leemon Baird <leemon@cs.cmu.edu>, http://www.cs.cmu.edu/~baird
The source and object code may be redistributed freely. If the code is modified, please state so in the comments.

Version:
1.0, 24 June 96
Author:
Leemon Baird

Variable Index

 o inSize
number of elements in the input vector (including first which is 1.0)
 o nPairs
number of input/output pairs (-1 if infinite)
 o outSize
number of elements in the output vector
 o watchManager
the WatchManager that variables here may be registered with
 o wmName
the prefix string for the name of every watched variable (passed in to setWatchManager)

Constructor Index

 o Data()

Method Index

 o BNF(int)
 o getData(double[], double[], Random)
Put the input/output pair into arrays in/out.
 o getData(int, double[], double[])
Put the nth input/output pair into arrays in/out.
 o getName()
Return the variable "name" that was passed into setWatchManager
 o getParameters(int)
Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
 o getWatchManager()
Return the WatchManager set by setWatchManager().
 o initialize(int)
Initialize, either partially or completely.
 o inSize()
Return the number of elements in the input vector.
 o nPairs()
return the number of input/output pairs (-1 if infinite)
 o outSize()
return the number of elements in the output vector
 o parse(Parser, int)
Parse the input file to get the parameters for this object.
 o setWatchManager(WatchManager, String)
Register all variables with this WatchManager.
 o stop()
Close source files, etc.
 o unparse(Unparser, int)
Output a description of this object that can be parsed with parse().

Variables

 o inSize
 protected int inSize
number of elements in the input vector (including first which is 1.0)

 o outSize
 protected int outSize
number of elements in the output vector

 o nPairs
 protected int nPairs
number of input/output pairs (-1 if infinite)

 o watchManager
 protected WatchManager watchManager
the WatchManager that variables here may be registered with

 o wmName
 protected String wmName
the prefix string for the name of every watched variable (passed in to setWatchManager)

Constructors

 o Data
 public Data()

Methods

 o setWatchManager
 public void setWatchManager(WatchManager wm,
                             String name)
Register all variables with this WatchManager.

 o getName
 public String getName()
Return the variable "name" that was passed into setWatchManager

 o getWatchManager
 public WatchManager getWatchManager()
Return the WatchManager set by setWatchManager().

 o inSize
 public int inSize()
Return the number of elements in the input vector. This includes the first element which is always a 1.0 (for Data objects that do that).

 o outSize
 public int outSize()
return the number of elements in the output vector

 o nPairs
 public int nPairs()
return the number of input/output pairs (-1 if infinite)

 o stop
 public void stop()
Close source files, etc.

 o getData
 public abstract void getData(double in[],
                              double out[],
                              Random rnd)
Put the input/output pair into arrays in/out. The arrays must already have been initialized to the right sizes. in[0] will always be set to 1.0. A randomly-chosen data point will be returned.

 o getData
 public abstract void getData(int n,
                              double in[],
                              double out[]) throws ArrayIndexOutOfBoundsException
Put the nth input/output pair into arrays in/out. The arrays must already have been initialized to the right sizes. in[0] will always be set to 1.0. An exception is raised if n<0 or n>=nPairs. If number of pairs is infinite, then exception is always thrown.

Throws: ArrayIndexOutOfBoundsException
arrays were too small or there is no "nth" data item
 o getParameters
 public Object[][] getParameters(int lang)
Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.

See Also:
getParameters
 o BNF
 public abstract String BNF(int lang)
 o unparse
 public abstract void unparse(Unparser u,
                              int lang)
Output a description of this object that can be parsed with parse().

See Also:
Parsable
 o parse
 public abstract Object parse(Parser p,
                              int lang) throws ParserException
Parse the input file to get the parameters for this object.

Throws: ParserException
parser didn't find the required token
 o initialize
 public void initialize(int level)
Initialize, either partially or completely.

See Also:
initialize

All Packages  Class Hierarchy  This Package  Previous  Next  Index