|
|||||||||
| Home >> All >> riso >> [ distributions overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
riso.distributions
Class IndexedDistribution

java.lang.Objectriso.distributions.AbstractConditionalDistribution
riso.distributions.IndexedDistribution
- All Implemented Interfaces:
- ConditionalDistribution, java.io.Serializable
- public class IndexedDistribution
- extends AbstractConditionalDistribution
An instance of this class represents a set of conditional distributions which are indexed by one or more discrete variables.
| Field Summary | |
private double[] |
c2
Allocate this only once; contains non-index values for p(). |
ConditionalDistribution[] |
components
List of conditional distributions indexed within this distribution. |
private java.lang.String |
components_string
Put off parsing the components until they are needed, since the parsing cannot be done before the whole belief network has been parsed, because we need a pointer to each parent and those pointers haven't been assigned when Variable.pretty_input is called. |
int[] |
index_dimensions
Dimensions of the parents which are indexes. |
(package private) java.lang.String[] |
index_names
List of the names of the parents which are indexes. |
int[] |
indexes
List of which parents are indexes. |
int[] |
non_indexes
List of which parents are NOT indexes. |
| Fields inherited from class riso.distributions.AbstractConditionalDistribution |
associated_variable |
| Constructor Summary | |
IndexedDistribution()
|
|
| Method Summary | |
(package private) void |
assign_indexes()
Uses information about parents to cache indexing lists. |
void |
check_components()
If the components' descriptions have not yet been parsed, do so now. |
java.lang.Object |
clone()
Return a deep copy of this object. |
java.lang.String |
format_string(java.lang.String leading_ws)
Create a description of this indexed distribution model as a string. |
Distribution |
get_density(double[] c)
For a given value c of the parents, return a distribution
which represents p(x|C=c). |
int |
ndimensions_child()
Return the number of dimensions of the child variable. |
int |
ndimensions_parent()
Return the number of dimensions of the parent variables. |
double |
p(double[] x,
double[] c)
Compute the density at the point x. |
(package private) void |
parse_components_string()
Parse the string representation of the components of this indexed distribution. |
void |
pretty_input(riso.general.SmarterTokenizer st)
Read a description of this indexed distribution from an input stream. |
double[] |
random(double[] c)
Return an instance of a random variable from this distribution. |
| Methods inherited from class riso.distributions.AbstractConditionalDistribution |
get_nstates, parse_string, pretty_output, set_variable, toString |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
index_names
java.lang.String[] index_names
- List of the names of the parents which are indexes.
indexes
public int[] indexes
- List of which parents are indexes. E.g., if the parents are X, Y,
Z, and W, and the first and third are indexes, then the list has 2 elements,
namely 0 and 2.
non_indexes
public int[] non_indexes
- List of which parents are NOT indexes. E.g., if the parents are X, Y,
Z, and W, and the first and third are indexes, then the list has 2 elements,
namely 1 and 3.
index_dimensions
public int[] index_dimensions
- Dimensions of the parents which are indexes. E.g., if one parent is an index which takes
on 10 values (0 through 9), and another takes on 7 values, and a third index takes on
13 values, then this list has 3 elements, 7, 10, and 13.
components
public ConditionalDistribution[] components
- List of conditional distributions indexed within this distribution. The list is stored
flat, in row-major order.
components_string
private java.lang.String components_string
- Put off parsing the components until they are needed, since the
parsing cannot be done before the whole belief network has been
parsed, because we need a pointer to each parent and those pointers
haven't been assigned when Variable.pretty_input is called.
c2
private double[] c2
- Allocate this only once; contains non-index values for p().
| Constructor Detail |
IndexedDistribution
public IndexedDistribution()
| Method Detail |
check_components
public void check_components()
throws java.io.IOException,
java.lang.IllegalArgumentException
- If the components' descriptions have not yet been parsed,
do so now. If components are already parsed, do nothing.
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
- Return a deep copy of this object.
- Specified by:
clonein interfaceConditionalDistribution- Overrides:
clonein classAbstractConditionalDistribution
ndimensions_child
public int ndimensions_child()
- Return the number of dimensions of the child variable.
ndimensions_parent
public int ndimensions_parent()
- Return the number of dimensions of the parent variables.
If there is more than one parent, this is the sum of the dimensions
of the parent variables.
get_density
public Distribution get_density(double[] c) throws java.lang.Exception
- For a given value
cof the parents, return a distribution which representsp(x|C=c). Executingget_density(c). p(x)will yield the same result asp(x,c).In the case of indexed distributions, we'll use the indexes in c to obtain the distribution q of interest, then use the rest of the elements (call them c2 collectively) to obtain q.get_density(c2).
p
public double p(double[] x,
double[] c)
throws java.lang.Exception
- Compute the density at the point
x.
random
public double[] random(double[] c)
throws java.lang.Exception
- Return an instance of a random variable from this distribution.
format_string
public java.lang.String format_string(java.lang.String leading_ws) throws java.io.IOException
- Create a description of this indexed distribution model as a string.
This is a full description, suitable for printing, containing
newlines and indents.
pretty_input
public void pretty_input(riso.general.SmarterTokenizer st) throws java.io.IOException
- Read a description of this indexed distribution from an input stream.
This is intended for input from a human-readable source; this is
different from object serialization.
- Overrides:
pretty_inputin classAbstractConditionalDistribution
parse_components_string
void parse_components_string()
throws java.io.IOException
- Parse the string representation of the components of this indexed
distribution. The string was saved by pretty_input, since
it could not be parsed then. See components_string.
assign_indexes
void assign_indexes()
throws java.lang.IllegalArgumentException,
java.rmi.RemoteException,
java.lang.Exception
- Uses information about parents to cache indexing lists.
This method can only be called after parent references have been
assigned within the belief network.
|
|||||||||
| Home >> All >> riso >> [ distributions overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC