All Packages Class Hierarchy This Package Previous Next Index
Class berkeley.cs.dmc.probtree.ProbabilityTree
java.lang.Object
|
+----berkeley.cs.dmc.probtree.ProbabilityTree
- public class ProbabilityTree
- extends Object
- implements Cloneable
Probability trees are region subdivision trees (quadtrees, octrees)
that represent probability densities. The actual distribution stored is
a multi-variate discrete distribution, obtained by binning samples
according to the subdivision.
-
ProbabilityTree(int, int, double[], double[])
- Create a new tree with specified dimension and maximum depth.
-
accumulate(double)
- Accumulate the data in the tree.
-
addSample(double[])
- Add the information from one sample to the tree.
-
clearData()
- Clears the tree and resets all the children to have zero density.
-
clone()
- The clone routine.
-
density(double[])
- Get the value of the density function at a particular point.
-
difference(ProbabilityTree)
- Returns the difference between 2 trees, measured using the L1 norm.
-
findNonZero(double[][])
- Returns info about all the non-zero cells.
-
getSample(double[])
- Samples a value.
-
maxDensity()
- Returns the maximum density occuring in this distribution.
-
numNonZero()
- Returns the number of cells with non-zero probability.
-
output(PrintWriter)
- Write code to sample from the distribution.
-
plotPixels(int[], int, int, double)
- Plots the distribution in the given pixel array.
-
print()
- Prints a representation of the tree on system output.
ProbabilityTree
public ProbabilityTree(int dim,
int max_depth,
double steps[],
double mins[])
- Create a new tree with specified dimension and maximum depth.
Here, dimension means the size of the random vector that must
be stored. The maximum depth defines the resolution of the
subdivision. It is the number of times space will be subdivided in
each dimension. The steps and mins define the region of interest.
- Parameters:
- dim - The dimension of the tree.
- max_depth - The maximum depth.
- steps - The length of the region of interest in each dimension.
- mins - The minimum value in each dimension.
clone
public Object clone()
- The clone routine.
- Overrides:
- clone in class Object
addSample
public void addSample(double value[])
- Add the information from one sample to the tree.
- Parameters:
- value - The value of the sample. This value is destroyed.
density
public double density(double value[])
- Get the value of the density function at a particular point.
- Parameters:
- value - The point. This value is destroyed.
- Returns:
- The density at that point.
accumulate
public void accumulate(double threshold)
- Accumulate the data in the tree. This normalizes the distribution,
builds cumulative distribution functions, and contracts the tree.
If the maximum difference between the probability of the child
nodes at any level is less than the threshold, then those children
will be combined. Lower thresholds result in less compression.
- Parameters:
- threshold - The minimum difference between child nodes.
difference
public double difference(ProbabilityTree other)
- Returns the difference between 2 trees, measured using the L1 norm.
- Parameters:
- other - The other tree.
- Returns:
- The difference.
output
public void output(PrintWriter out)
- Write code to sample from the distribution.
- Parameters:
- out - The output writer.
getSample
public void getSample(double vals[])
- Samples a value. It is assumed that the distribution is uniform within
each cell of the subdivision, so any real value within the cell
maybe returned..
- Parameters:
- s - vals Will be filled with the sample.
maxDensity
public double maxDensity()
- Returns the maximum density occuring in this distribution.
numNonZero
public int numNonZero()
- Returns the number of cells with non-zero probability.
- Returns:
- The number of cells.
findNonZero
public void findNonZero(double entries[][])
- Returns info about all the non-zero cells. In entries it puts
a weighted probability, the actual probability, and the dimensions
of the cell. Entries should have dimensions at least numNonZero()
by 2 * dimension + 2.
- Parameters:
- entries - Space for the requested data.
clearData
public void clearData()
- Clears the tree and resets all the children to have zero density.
plotPixels
public void plotPixels(int pixels[],
int width,
int height,
double max)
- Plots the distribution in the given pixel array.
- Parameters:
- pixels - The pixel array to fill.
- width - The width of the image.
- height - The height of the image.
- max - The maximum probability in the tree, from maxDensity().
print
public void print()
- Prints a representation of the tree on system output.
All Packages Class Hierarchy This Package Previous Next Index