com.rapidminer.tools.math.distribution
Class DiscreteDistribution

java.lang.Object
  extended by com.rapidminer.tools.math.distribution.DiscreteDistribution
All Implemented Interfaces:
Distribution, java.io.Serializable

public class DiscreteDistribution
extends java.lang.Object
implements Distribution

The distribution for a discrete variable.

Author:
Tobias Malbrecht
See Also:
Serialized Form

Constructor Summary
DiscreteDistribution(java.lang.String attributeName, double[] probabilities, java.lang.String[] valueNames)
           
 
Method Summary
 java.lang.String getAttributeName()
          Returns the name of the attribute the distribution belongs to.
 int getNumberOfParameters()
          This should return the number of parameters defining this distribution
 java.lang.String getParameterName(int index)
          This method should return the name of the i-th parameter
 double getParameterValue(int index)
          This method should return the value of the i-th parameter
 double getProbability(double value)
          This method returns the density of the given distribution at the specified value.
 java.lang.String[] getValueNames()
           
 java.util.ArrayList<java.lang.Double> getValues()
          This method returns a collection of all nominal attribute values.
 boolean isContinuous()
           
 boolean isDiscrete()
           
 java.lang.String mapValue(double value)
          this method should return a string representation of the given value.
 java.lang.String toString()
          Should return an textual representation of the distribution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DiscreteDistribution

public DiscreteDistribution(java.lang.String attributeName,
                            double[] probabilities,
                            java.lang.String[] valueNames)
Method Detail

isDiscrete

public final boolean isDiscrete()
Specified by:
isDiscrete in interface Distribution

isContinuous

public final boolean isContinuous()
Specified by:
isContinuous in interface Distribution

getProbability

public double getProbability(double value)
Description copied from interface: Distribution
This method returns the density of the given distribution at the specified value.

Specified by:
getProbability in interface Distribution
Parameters:
value - the value which density shall be returned

getAttributeName

public java.lang.String getAttributeName()
Returns the name of the attribute the distribution belongs to.

Specified by:
getAttributeName in interface Distribution

getValues

public java.util.ArrayList<java.lang.Double> getValues()
This method returns a collection of all nominal attribute values. TODO: This is not fully legally: not guaranteed that the indices are in a sequence, starting with 0!!!


mapValue

public java.lang.String mapValue(double value)
Description copied from interface: Distribution
this method should return a string representation of the given value. Numerical Attributes might return a string representation of the value.

Specified by:
mapValue in interface Distribution

toString

public java.lang.String toString()
Description copied from interface: Distribution
Should return an textual representation of the distribution.

Specified by:
toString in interface Distribution
Overrides:
toString in class java.lang.Object

getNumberOfParameters

public int getNumberOfParameters()
Description copied from interface: Distribution
This should return the number of parameters defining this distribution

Specified by:
getNumberOfParameters in interface Distribution

getParameterName

public java.lang.String getParameterName(int index)
Description copied from interface: Distribution
This method should return the name of the i-th parameter

Specified by:
getParameterName in interface Distribution

getParameterValue

public double getParameterValue(int index)
Description copied from interface: Distribution
This method should return the value of the i-th parameter

Specified by:
getParameterValue in interface Distribution

getValueNames

public java.lang.String[] getValueNames()


Copyright © 2001-2009 by Rapid-I