de.fu_berlin.ties.classify
Class Probability

java.lang.Object
  extended by de.fu_berlin.ties.classify.Probability

public class Probability
extends Object

Wraps a probability. Optionally also wraps a "pR" value that can be used to decide between probabilities that are very similar (e.g. ~1.0), because it is less sensitive to rounding issues. Instance of this class are immutable and thus thread-safe.

Version:
$Revision: 1.1 $, $Date: 2004/11/19 14:04:19 $, $Author: siefkes $
Author:
Christian Siefkes

Constructor Summary
Probability(double theProb)
          Creates a new instance, setting the pR to Double.NaN (unknown).
Probability(double theProb, double thePR)
          Creates a new instance.
 
Method Summary
 double getPR()
          Returns the optional pR: pR = log(p / (1-p)); or Double.NaN if not known/not relevant.
 double getProb()
          Returns the actual probability; will be in value in the range from 0 to 1; or -1 if the actual value is unknown/not applicable.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Probability

public Probability(double theProb)
Creates a new instance, setting the pR to Double.NaN (unknown).

Parameters:
theProb - the probability of the prediction (must be in the range from 0.0 to 1.0; or -1 if this is a confirmed prediction or an answer key)

Probability

public Probability(double theProb,
                   double thePR)
Creates a new instance.

Parameters:
theProb - the probability of the prediction (must be in the range from 0.0 to 1.0; or -1 if this is a confirmed prediction or an answer key)
thePR - the pR of the prediction; or Double.NaN if not known
Method Detail

getPR

public double getPR()
Returns the optional pR: pR = log(p / (1-p)); or Double.NaN if not known/not relevant.

Returns:
the value of the attribute

getProb

public double getProb()
Returns the actual probability; will be in value in the range from 0 to 1; or -1 if the actual value is unknown/not applicable.

Returns:
the value of the attribute

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Object
Returns:
a textual representation


Copyright © 2003-2004 Christian Siefkes. All Rights Reserved.