algorithm - Gaussian Mixture Model - Matlab training for parameters -
i running speech enhancement algorithm based on gaussian mixture model. problem estimation algorithm underflows during training processing. trying calculate pdf of log spectrum frame x
given gaussian cluster product of pdf of each frequnecy component x_k
(fft done k=1..256) product of 256 exp(-v(k))
such v(k)>=0
here snippet of matlab calculation: n
- number of frames; m
- number of mixtures; c_i
weight each mixture;
gamma(n,i) = c_i*f(x_n|i = i)
i=1 : n rep_datamat(:,:,i) = repmat(datamat(:,i),1,m); gamma_exp(:,:) = (1./sqrt((2*pi*sigmasqr_curr))).*exp(((-1)*((rep_datamat(:,:,i) - mue_curr).^2)./(2*sigmasqr_curr))); gamma_curr(i,:) = c_curr.*(prod(10*gamma_exp(:,:),1)); alpha_curr(i,:) = gamma_curr(i,:)./sum(gamma_curr(i,:)); end
the product goes 0 due k = 256 since numbers being smaller one. there way can calculate causing underflow (like logsum or similar)?
you can perform computations in log domain.
the conversion of products sums straightforward. sums on other hand can converted such logsumexp. works using formula:
log(a + b) = log(exp(log(a)) + exp(log(b))) = log(exp(loga) + exp(logb))
where loga
, logb
respective representation of a
, b
in log domain. basic idea factorize exponent largest argument (eg. loga
sake of illustration):
log(exp(loga)+exp(logb)) = log(exp(loga)*(1+exp(logb-loga))) = loga + log(1+exp(logb-loga))
note same idea applies if have more 2 terms add.
Comments
Post a Comment