Initialize Dirichlet fitting without sample variable#2077
Conversation
e85d66b to
4b5191e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2077 +/- ##
==========================================
- Coverage 86.74% 86.74% -0.01%
==========================================
Files 149 149
Lines 8883 8881 -2
==========================================
- Hits 7706 7704 -2
Misses 1177 1177 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This avoids dividing by zero. The new initialization is based on the paper by Thomas Minka linked in the comment.
|
AFAICT the PR mixes two approaches presented by Minka, the EM-like fixed-point iteration and the Newton algorithm. It's not immediately clear to me why one would want to combine those two approaches and switch after a seemingly arbitrary amount of 5 fixed-point iterations to the Newton algorithm. IMO the crucial and currently in a few cases problematic part is just the initialization of the algorithms. As Minka mentions as well, there's many different possible approaches for initializing the algorithms, e.g., based on method of moments (obviously, different choices of moments will lead to different initializations, Minka already discusses two different approaches) or approximations of the likelihood function, e.g., using Stirling's approximation. Exploiting the moment equations which AFAICT would give moment estimates (seemingly a symmetrized version of eq. 21?). This would only break down if the sample variance of all So, taken together, my impression is: Using eq. 42 would give a less brittle initialization but one could also consider other approaches, e.g., based on different moments; but it's not clear to me why one would want to combine the EM-like fixed-point iteration with the Newton algorithm, using a different more stable initialization for the Newton algorithm alone (or the EM-like fixed-point iteration, if one prefers that approach) seems sufficient. |
|
The problem is that the parameters must be positive, so the initialization has to be sufficiently good to ensure that the Newton step is feasible. The fixed-point iterations will always produce positive values, but it has linear convergence. I also tried the initialization suggested in https://www.sciencedirect.com/science/article/abs/pii/S0167947307002848, but then I can trigger a maxiter error by making the repeated value small enough. |
|
To me it seems there's two separate problems you're facing and trying to address: the problematic initialization (the original issue reported in #602) and infeasible iterates of the Newton algorithm. Seemingly the first problem could be fixed by an initialization that doesn't break down if the sample variance of some |
|
The two issues are closely related. In theory, we could just initialize all the values at one, except for the risk of stepping to an infeasible argument. Hence, we need to find a sufficiently good initialization before switching to Newton's method and thereby ensure fast convergence through the concave objective function.
Yes, but as mentioned above, I could trigger maxiter issues with these initializers.
The global concavity of the objective function is not preserved under this reparametrization. We could try a constrained optimizer, but that would be a larger change than the current one. |
|
To avoid the concavity issue, we could use natural gradient descent in log space instead of of Newton's method. In the standard parameter space, Newton's method is exactly the natural gradient method with step size 1 (the Hessian is constant with respect to the data and hence identical to the FIM). AFAICT this would correspond to iterations |
This avoids dividing by zero. The new initialization is based on the paper by Thomas Minka linked in the comment. This is an alternative to #610 based on some of the ideas in the paper. It also avoids the extra allocation. Of course, at the cost of some special function evaluations.
Fixes #602