CumulativeDiscreteDistribution

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.classifiers.misc.monotone
Class CumulativeDiscreteDistribution

    java.lang.Object
      weka.classifiers.misc.monotone.CumulativeDiscreteDistribution

All Implemented Interfaces:
  java.io.Serializable, RevisionHandler

    public class CumulativeDiscreteDistribution

extends java.lang.Object
implements java.io.Serializable, RevisionHandler

Represents a discrete cumulative probability distribution over a totally ordered discrete set. The elements of this set are numbered consecutively starting from 0.

In this implementation object of type `CumulativeDiscreteDistribution` are immutable.

This implementation is part of the master's thesis: "Studie en implementatie van instantie-gebaseerde algoritmen voor gesuperviseerd rangschikken", Stijn Lievens, Ghent University, 2004.

Version:
  $Revision: 1.2 $
Author:
  Stijn Lievens (stijn.lievens@ugent.be)
See Also:
  Serialized Form

Constructor Summary
`CumulativeDiscreteDistribution(DiscreteDistribution d)` Create a `CumulativeDiscreteDistribution` based on a `DiscreteDistribution.`
`CumulativeDiscreteDistribution(DiscreteEstimator e)` Create a discrete cumulative probability distribution based on a `DiscreteEstimator.`
`CumulativeDiscreteDistribution(double[] cdf)` Create a `CumulativeDiscreteDistribution` based on an array of doubles.

Method Summary
`boolean` | `equals(java.lang.Object o)` Indicates if the object `o` equals `this.`
`double` | `getCumulativeProbability(int index)` Get the probability of finding an element smaller or equal than `index.`
`int` | `getNumSymbols()` Get the number of elements over which the cumulative probability distribution is defined.
`java.lang.String` | `getRevision()` Returns the revision string.
`boolean` | `stochasticDominatedBy(CumulativeDiscreteDistribution cdf)` Returns if `this` is dominated by `cdf.`
`double[]` | `toArray()` Get an array representation of the cumulative probability distribution.
`java.lang.String` | `toString()` Get a string representation of the cumulative probability distribution.

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CumulativeDiscreteDistribution

    public CumulativeDiscreteDistribution(DiscreteEstimator e)

  Create a discrete cumulative probability distribution based on a `DiscreteEstimator.`

  Parameters:
    `e` - the `DiscreteEstimator` on which the cumulative probability distribution will be based

### CumulativeDiscreteDistribution

    public CumulativeDiscreteDistribution(DiscreteDistribution d)

  Create a `CumulativeDiscreteDistribution` based on a `DiscreteDistribution.`

  Parameters:
    `d` - the `DiscreteDistribution` on which the cumulative probability distribution will be based

### CumulativeDiscreteDistribution

    public CumulativeDiscreteDistribution(double[] cdf)
                                   throws java.lang.IllegalArgumentException

  Create a `CumulativeDiscreteDistribution` based on an array of doubles. The array `cdf` is copied, so the caller can reuse the same array.

  Parameters:
    `cdf` - an array that represents a valid discrete cumulative probability distribution
  Throws:
    `java.lang.IllegalArgumentException` - if the array doesn't represent a valid cumulative discrete distribution function

Method Detail

### getNumSymbols

    public int getNumSymbols()

  Get the number of elements over which the cumulative probability distribution is defined.

  Returns:
    the number of elements over which the cumulative probability distribution is defined.

### getCumulativeProbability

    public double getCumulativeProbability(int index)

  Get the probability of finding an element smaller or equal than `index.`

  Parameters:
    `index` - the required index
  Returns:
    the probability of finding an element <= index

### toArray

    public double[] toArray()

  Get an array representation of the cumulative probability distribution.

  Returns:
    an array of doubles representing the cumulative probability distribution

### stochasticDominatedBy

    public boolean stochasticDominatedBy(CumulativeDiscreteDistribution cdf)
                                  throws java.lang.IllegalArgumentException

  Returns if `this` is dominated by `cdf.` This means that we check if, for all indices `i` , it holds that `this.getProbability(i) >= cdf.getProbability(i).`

  Parameters:
    `cdf` - the `CumulativeDiscreteDistribution` `this` is compared to
  Returns:
    `true` if `this` is dominated by `cdf` , `false` otherwise
  Throws:
    `java.lang.IllegalArgumentException` - if the two distributions don't have the same length

### equals

    public boolean equals(java.lang.Object o)

  Indicates if the object `o` equals `this.` Note: for practical reasons I was forced to use a small tolerance whilst comparing the distributions, meaning that the transitivity property of `equals` is not guaranteed.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `o` - the reference object with which to compare
  Returns:
    `true` if `o` equals `this,` `false` otherwise

### toString

    public java.lang.String toString()

  Get a string representation of the cumulative probability distribution.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representation of the distribution.

### getRevision

    public java.lang.String getRevision()

  Returns the revision string.

  Specified by:
    `getRevision` in interface `RevisionHandler`
  Returns:
    the revision

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD