From 5d1afa649672972dc48b186335189808de7a6043 Mon Sep 17 00:00:00 2001 From: Jonathan Schneider Date: Thu, 12 Nov 2020 13:29:27 +0100 Subject: [PATCH 1/3] Fix misleading help text see https://stackoverflow.com/questions/52099379/mallet-hyperparameter-optimization --- src/cc/mallet/topics/tui/TopicTrainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/mallet/topics/tui/TopicTrainer.java b/src/cc/mallet/topics/tui/TopicTrainer.java index 951bf37e9..b00841906 100644 --- a/src/cc/mallet/topics/tui/TopicTrainer.java +++ b/src/cc/mallet/topics/tui/TopicTrainer.java @@ -147,7 +147,7 @@ public class TopicTrainer { "The number of iterations to run before first estimating dirichlet hyperparameters.", null); static CommandOption.Boolean useSymmetricAlpha = new CommandOption.Boolean(TopicTrainer.class, "use-symmetric-alpha", "true|false", false, false, - "Only optimize the concentration parameter of the prior over document-topic distributions. This may reduce the number of very small, poorly estimated topics, but may disperse common words over several topics.", null); + "Only optimize the concentration parameter of the prior over topic-words distributions. This may reduce the number of very small, poorly estimated topics, but may disperse common words over several topics.", null); static CommandOption.Double alpha = new CommandOption.Double(TopicTrainer.class, "alpha", "DECIMAL", true, 5.0, "SumAlpha parameter: sum over topics of smoothing over doc-topic distributions. alpha_k = [this value] / [num topics]",null); From fe6838add525b1a1d99c8985621335b70200ed0e Mon Sep 17 00:00:00 2001 From: Jonathan Schneider Date: Wed, 19 May 2021 18:29:48 +0200 Subject: [PATCH 2/3] Improve misleading help text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dirichlet Distribution := Distribution over K-dimensional positive vectors that sum to one (i.e., points on the probability simplex) Two parameters: - Base measure (positive vector; sums to one) - Concentration parameter α (positive scalar) See https://people.cs.umass.edu/~wallach/talks/priors.pdf --- src/cc/mallet/topics/tui/TopicTrainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/mallet/topics/tui/TopicTrainer.java b/src/cc/mallet/topics/tui/TopicTrainer.java index b00841906..80ecff742 100644 --- a/src/cc/mallet/topics/tui/TopicTrainer.java +++ b/src/cc/mallet/topics/tui/TopicTrainer.java @@ -147,7 +147,7 @@ public class TopicTrainer { "The number of iterations to run before first estimating dirichlet hyperparameters.", null); static CommandOption.Boolean useSymmetricAlpha = new CommandOption.Boolean(TopicTrainer.class, "use-symmetric-alpha", "true|false", false, false, - "Only optimize the concentration parameter of the prior over topic-words distributions. This may reduce the number of very small, poorly estimated topics, but may disperse common words over several topics.", null); + "Optimize the concentration parameter (SumAlpha) of the prior over document-topic distributions while keeping it symmetric. This may reduce the number of very small, poorly estimated topics, but may disperse common words over several topics.", null); static CommandOption.Double alpha = new CommandOption.Double(TopicTrainer.class, "alpha", "DECIMAL", true, 5.0, "SumAlpha parameter: sum over topics of smoothing over doc-topic distributions. alpha_k = [this value] / [num topics]",null); From 0072ad7c5e978bb19e7ba9ecb601adc24eeda642 Mon Sep 17 00:00:00 2001 From: Jonathan Schneider Date: Fri, 21 May 2021 18:26:29 +0200 Subject: [PATCH 3/3] Add reference to Hanna Wallach's Ph.D. thesis see http://dirichlet.net/pdf/wallach08structured.pdf --- src/cc/mallet/types/Dirichlet.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cc/mallet/types/Dirichlet.java b/src/cc/mallet/types/Dirichlet.java index 4f73d61a2..857136a5a 100644 --- a/src/cc/mallet/types/Dirichlet.java +++ b/src/cc/mallet/types/Dirichlet.java @@ -555,6 +555,8 @@ public static void testSymmetricConcentration(int numDimensions, int numObservat /** * Learn Dirichlet parameters using frequency histograms + * described by Hanna Wallach in "Structured Topic Models for Language" (2008), section 2.4 + * Method 1: Using the Digamma Recurrence Relation (pp. 27-28) * * @param parameters A reference to the current values of the parameters, which will be updated in place * @param observations An array of count histograms. observations[10][3] could be the number of documents that contain exactly 3 tokens of word type 10. @@ -571,6 +573,8 @@ public static double learnParameters(double[] parameters, /** * Learn Dirichlet parameters using frequency histograms + * described by Hanna Wallach in "Structured Topic Models for Language", section 2.4 + * Method 1: Using the Digamma Recurrence Relation (pp. 27-28) and gamma hyperpriors (section 2.5, pp. 37-39) * * @param parameters A reference to the current values of the parameters, which will be updated in place * @param observations An array of count histograms. observations[10][3] could be the number of documents that contain exactly 3 tokens of word type 10.