|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.knowceans.util.DirichletEstimation
public class DirichletEstimation
DirichletEstimation provides a number of methods to estimate parameters of a Dirichlet distribution and the Dirichlet-multinomial (Polya) distribution. Most of the algorithms described in Minka (2003) Estimating a Dirichlet distribution, but some home-grown extensions.
| Constructor Summary | |
|---|---|
DirichletEstimation()
|
|
| Method Summary | |
|---|---|
static int |
alphaFixedPoint(double[] suffstats,
double[] alpha)
fixpoint iteration on alpha. |
static void |
alphaNewton(int N,
double[] suffstats,
double[] alpha)
|
static double[] |
estimateAlpha(double[][] pp)
Estimator for the Dirichlet parameters. |
static double[] |
estimateAlpha(int[][] nmk)
Estimator for the Dirichlet parameters from counts. |
static int |
estimateAlphaLoo(double[] alpha,
int[][] nmk)
Polya estimation using the fixed point iteration of the leave-one-out likelihood, after Minka 2003. |
static double[] |
estimateAlphaMap(int[][] nmk,
int[] nm,
double[] alpha,
double a,
double b)
fixpoint iteration on alpha using counts as input and estimating by Polya distribution directly. |
static double |
estimateAlphaMap(int[][] nmk,
int[] nm,
double alpha,
double a,
double b)
fixpoint iteration on alpha using counts as input and estimating by Polya distribution directly. |
static double |
estimateAlphaMapSub(int[][] nmk,
int[] nm,
int[] mrows,
double alpha,
double a,
double b)
fixpoint iteration on alpha using counts as input and estimating by Polya distribution directly. |
static double |
estimateAlphaMomentMatch(int[][] nmk,
int[] nm)
|
static double[] |
estimateMeanPrec(double[][] pp)
estimate mean and precision of the observations separately. |
static double[] |
estimateMeanPrec(int[][] nn)
Estimate mean and precision of the observations separately from counts. |
static double[] |
getAlpha(double[] meanPrec)
Get the alpha vector out of a mean precision combined vector. |
static double[] |
getMean(double[] meanPrec)
Get the mean out of a mean precision combined vector. |
static double |
getPrec(double[] meanPrec)
Get the precision out of a mean precision combined vector |
static double[] |
guessAlpha(double[][] pp,
double[] pmean)
Estimate the dirichlet parameters using the moments method |
static double[] |
guessAlpha(int[][] nmk)
guess alpha via Dirichlet parameter point estimate and Dirichlet moment matching. |
static double[] |
guessAlphaDirect(int[][] nmk,
int[] nm)
guess alpha via "direct" moment matching on the Polya distribution (which is just Dirichlet moment matching in disguise). |
static double[] |
guessMean(double[][] pp)
Estimate the Dirichlet mean of the data along columns |
static double |
guessPrecision(double[] pmean,
double[] pmeansq)
Estimate the Dirichlet precision using moment matching method. |
static void |
main(java.lang.String[] args)
|
static void |
testDirichlet()
|
static void |
testPolya()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DirichletEstimation()
| Method Detail |
|---|
public static double[] estimateAlpha(double[][] pp)
multinomial - parameters p
public static double[] estimateMeanPrec(double[][] pp)
pp - input data with vectors in rows
public static double[] estimateAlpha(int[][] nmk)
nn - counts in each multinomial experiment
public static int estimateAlphaLoo(double[] alpha,
int[][] nmk)
alpha - [in/out] Dirichlet parameter with element for each knmk - count matrix with individual observations in rows
("documents") and categories in columns ("topics")
public static double[] estimateMeanPrec(int[][] nn)
nn - input data with vectors in rows
public static double getPrec(double[] meanPrec)
meanPrec -
public static double[] getMean(double[] meanPrec)
meanPrec -
public static double[] getAlpha(double[] meanPrec)
meanPrec -
public static double[] guessAlpha(double[][] pp,
double[] pmean)
pp - data with items in rows and dimensions in colspmean - first moment of pp
public static double[] guessMean(double[][] pp)
pp -
public static double[] guessAlpha(int[][] nmk)
nmk -
public static double[] guessAlphaDirect(int[][] nmk,
int[] nm)
nmk - nm - sums of observations for all categories (eg document lengths,
ndsum)
public static double guessPrecision(double[] pmean,
double[] pmeansq)
pmean - pmeansq -
public static void alphaNewton(int N,
double[] suffstats,
double[] alpha)
public static int alphaFixedPoint(double[] suffstats,
double[] alpha)
suffstats - alpha - [in/out]
public static double estimateAlphaMomentMatch(int[][] nmk,
int[] nm)
public static double estimateAlphaMap(int[][] nmk,
int[] nm,
double alpha,
double a,
double b)
nmk - count data (documents in rows, topic associations in cols)nm - total counts across rowsalpha - alpha -
public static double estimateAlphaMapSub(int[][] nmk,
int[] nm,
int[] mrows,
double alpha,
double a,
double b)
nmk - count data (documents in rows, topic associations in cols)nm - total counts across rowsmrows - set of rows to be used for estimationalpha - alpha -
public static double[] estimateAlphaMap(int[][] nmk,
int[] nm,
double[] alpha,
double a,
double b)
nmk - count data (documents in rows, topic associations in cols)nm - total counts across rowsalpha - [in/out]
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exceptionpublic static void testPolya()
public static void testDirichlet()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||