|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.AbstractCondProbDistrib blog.distrib.Geometric
public class Geometric
A geometric distribution over the natural numbers 0, 1, 2,... It has a single parameter alpha, which equals P(X >= n+1 | X >= n). Thus an alpha close to 1 yields a relatively flat distribution, whereas an alpha close to 0 yields a distribution that decays quickly. The distribution is defined by: P(X = n) = (1 - alpha) alpha^n. Its mean is alpha / (1-alpha), so to get a distribution with mean m, one should use alpha = m / (1 + m).
Note that alpha cannot be 1, because then the value is infinite with probability 1. However, alpha can be 0; this just means the value is 0 with probability 1.
Constructor Summary | |
---|---|
Geometric(double alpha)
Creates a geometric distribution with the given alpha parameter. |
|
Geometric(java.util.List params)
Creates a geometric distribution with the given alpha parameter. |
Method Summary | |
---|---|
static Geometric |
constructWithMean(double mean)
Returns a Geometric distribution with the given mean. |
double |
getLogProb(int n)
Returns the natural log of the probability of the given integer under this distribution. |
double |
getLogProb(java.util.List args,
java.lang.Object value)
Returns the log probability of the given value, which should be an Integer. |
double |
getProb(int n)
Returns the probability of the given integer under this distribution. |
double |
getProb(java.util.List args,
java.lang.Object value)
Returns the probability of the given value, which should be an Integer. |
int |
sampleVal()
Returns an integer sampled from this distribution. |
java.lang.Object |
sampleVal(java.util.List args,
Type childType)
Generates a sample from this distribution. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Geometric(double alpha)
java.lang.IllegalArgumentException
- if alpha
is not in
the range [0, 1)public Geometric(java.util.List params)
java.lang.IllegalArgumentException
- if alpha < 0 or alpha >= 1.Method Detail |
---|
public static Geometric constructWithMean(double mean)
public double getProb(int n)
public double getProb(java.util.List args, java.lang.Object value)
public double getLogProb(int n)
public double getLogProb(java.util.List args, java.lang.Object value)
getLogProb
in interface CondProbDistrib
getLogProb
in class AbstractCondProbDistrib
public java.lang.Object sampleVal(java.util.List args, Type childType)
public int sampleVal()
public java.lang.String toString()
toString
in class AbstractCondProbDistrib
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |