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.


Constructor Index

 o ProbabilityTree(int, int, double[], double[])
Create a new tree with specified dimension and maximum depth.

Method Index

 o accumulate(double)
Accumulate the data in the tree.
 o addSample(double[])
Add the information from one sample to the tree.
 o clearData()
Clears the tree and resets all the children to have zero density.
 o clone()
The clone routine.
 o density(double[])
Get the value of the density function at a particular point.
 o difference(ProbabilityTree)
Returns the difference between 2 trees, measured using the L1 norm.
 o findNonZero(double[][])
Returns info about all the non-zero cells.
 o getSample(double[])
Samples a value.
 o maxDensity()
Returns the maximum density occuring in this distribution.
 o numNonZero()
Returns the number of cells with non-zero probability.
 o output(PrintWriter)
Write code to sample from the distribution.
 o plotPixels(int[], int, int, double)
Plots the distribution in the given pixel array.
 o print()
Prints a representation of the tree on system output.

Constructors

 o 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.

Methods

 o clone
 public Object clone()
The clone routine.

Overrides:
clone in class Object
 o 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.
 o 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.
 o 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.
 o 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.
 o output
 public void output(PrintWriter out)
Write code to sample from the distribution.

Parameters:
out - The output writer.
 o 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.
 o maxDensity
 public double maxDensity()
Returns the maximum density occuring in this distribution.

 o numNonZero
 public int numNonZero()
Returns the number of cells with non-zero probability.

Returns:
The number of cells.
 o 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.
 o clearData
 public void clearData()
Clears the tree and resets all the children to have zero density.

 o 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().
 o print
 public void print()
Prints a representation of the tree on system output.


All Packages  Class Hierarchy  This Package  Previous  Next  Index