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
-
inSize
- number of elements in the input vector (including first which is 1.0)
-
nPairs
- number of input/output pairs (-1 if infinite)
-
outSize
- number of elements in the output vector
-
watchManager
- the WatchManager that variables here may be registered with
-
wmName
- the prefix string for the name of every watched variable (passed in to setWatchManager)
-
Data()
-
-
BNF(int)
-
-
getData(double[], double[], Random)
- Put the input/output pair into arrays in/out.
-
getData(int, double[], double[])
- Put the nth input/output pair into arrays in/out.
-
getName()
- Return the variable "name" that was passed into setWatchManager
-
getParameters(int)
- Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
-
getWatchManager()
- Return the WatchManager set by setWatchManager().
-
initialize(int)
- Initialize, either partially or completely.
-
inSize()
- Return the number of elements in the input vector.
-
nPairs()
- return the number of input/output pairs (-1 if infinite)
-
outSize()
- return the number of elements in the output vector
-
parse(Parser, int)
- Parse the input file to get the parameters for this object.
-
setWatchManager(WatchManager, String)
- Register all variables with this WatchManager.
-
stop()
- Close source files, etc.
-
unparse(Unparser, int)
- Output a description of this object that can be parsed with parse().
inSize
protected int inSize
- number of elements in the input vector (including first which is 1.0)
outSize
protected int outSize
- number of elements in the output vector
nPairs
protected int nPairs
- number of input/output pairs (-1 if infinite)
watchManager
protected WatchManager watchManager
- the WatchManager that variables here may be registered with
wmName
protected String wmName
- the prefix string for the name of every watched variable (passed in to setWatchManager)
Data
public Data()
setWatchManager
public void setWatchManager(WatchManager wm,
String name)
- Register all variables with this WatchManager.
getName
public String getName()
- Return the variable "name" that was passed into setWatchManager
getWatchManager
public WatchManager getWatchManager()
- Return the WatchManager set by setWatchManager().
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).
outSize
public int outSize()
- return the number of elements in the output vector
nPairs
public int nPairs()
- return the number of input/output pairs (-1 if infinite)
stop
public void stop()
- Close source files, etc.
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.
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
getParameters
public Object[][] getParameters(int lang)
- Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
- See Also:
- getParameters
BNF
public abstract String BNF(int lang)
unparse
public abstract void unparse(Unparser u,
int lang)
- Output a description of this object that can be parsed with parse().
- See Also:
- Parsable
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
initialize
public void initialize(int level)
- Initialize, either partially or completely.
- See Also:
- initialize
All Packages Class Hierarchy This Package Previous Next Index