|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcommon.PermutationDistrib
public class PermutationDistrib
Defines, for each n, a distribution over the permutations of the sequence 0,...,n-1. The probability of a permutation depends on how many inversions it has (see the comments in Permutation.java). The distribution over the number of inversions is a geometric distribution, truncated at the maximum number of inversions that a permutation of 0,...,n-1 can have. Among permutations with a given number of inversions, the distribution is uniform. A PermutationDistrib has one parameter, the parameter alpha of the geometric distribution over the number of inversions. One way to think about how to set this parameter is to note that the probability of getting a permutation with no inversions (namely the original sequence 0,...n-1) is 1 - alpha.
Constructor Summary | |
---|---|
PermutationDistrib()
Creates a PermutationDistrib with alpha = 0.5. |
|
PermutationDistrib(double alpha)
Creates a PermutationDistrib with the given alpha parameter. |
Method Summary | |
---|---|
double |
getLogProb(int[] pi)
Returns the log probability of the given permutation. |
double |
getProb(int[] pi)
Returns the probability of the given permutation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PermutationDistrib()
public PermutationDistrib(double alpha)
Method Detail |
---|
public double getProb(int[] pi)
public double getLogProb(int[] pi)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |