I'm working on an online category learning model which uses stochastic gradient descent to fit a gaussian mixture model. The model is based on the online learning model used in Toscano & McMurray (2010).
While gradient descent seems to be working fairly well to estimate the means and frequencies/mixing probabilities of the categories, I'm having issues with estimating the covariances of mixture components. The partial derivatives I've been using for the gradient descent update come from Petersen & Pedersen (2008) (p. 44)
Starting with
$p(x) = \sum _k \rho_k \mathcal N_x(\mu_k,\Sigma_k)$
Petersen & Pedersen give the partial derivative with respect to the covariance matrix $\Sigma$ as
$\frac{\delta \ln p(x)}{\delta \Sigma_j}=\frac{\rho_j\mathcal N_x(\mu_j,\Sigma_j)}{\sum _k \rho_k \mathcal N_x(\mu_k,\Sigma_k)}\frac{1}{2}[-\Sigma_j^{-1}+\Sigma_j^{-1}(x-\mu_j)(x-\mu_j)^T\Sigma_j^{-1}]$
The gradient descent step for each $\Sigma_j$, as I've got it implemented in Python is (this is a slight simplification and the $\Delta\Sigma$ for all components is calculated before performing the update):
j.sigma += learning_rate*(G(x)/M(x))*0.5*(-inv(j.sigma) + inv(j.sigma).dot((x-j.mu).dot((x-j.mu).transpose())).dot(inv(j.sigma)))
Where j is an object representing the $j$th component of the mixture and j.sigma and j.mu are that component's mean and variance. G(x)/M(x) is standing in for some code that calculates $\frac{\rho_j\mathcal N_x(\mu_j,\Sigma_j)}{\sum _k \rho_k \mathcal N_x(\mu_k,\Sigma_k)}$
So, I'm wondering if there's something wrong with my code (highly likely) or if this is just a really bad way to fit this kind of model when dealing with data with more than two dimensions (See Toscano & McMurray for algorithms for univariate and bivariate data that definitely work).
references: Toscano, J. C., & McMurray, B. (2010). Cue integration with categories: Weighting acoustic cues in speech using unsupervised learning and distributional statistics. Cognitive Science, 34, 434-464.
Petersen & Pederson. The Matrix Cookbook, Version: November 14, 2008