public GMMDiag(int ng, int nc) { ngauss = ng; ncoefs = nc; allocate(); }
private void allocate() { if (weights == null) allocateWeights(); if (means == null) { loglikes = new float[ngauss]; means = new float[ngauss][ncoefs]; covar = new float[ngauss][ncoefs]; logPreComputedGaussianFactor = new float[ngauss]; } }
public Lab(String s, int n) { setName(s); setStateIdx(n); }
public SingleHMM getHMM(String nom) { SingleHMM h = null; for (SingleHMM hmm : hmms) { h = hmm; if (h.getName().equals(nom)) break; } return h; }
public float getLogLike() { return gmm.getLogLike(); }
public void saveHTK(String nomFich, String nomHMM) { saveHTK(nomFich, nomHMM, "<USER>"); }
int getNumStates() { return hmmsHTK.getNstates(); }
int getNumHMMs() { return hmmsHTK.getNhmms(); }
public Lab(String s) { setName(s); }
int getGMMSize() { GMMDiag gmm = hmmsHTK.gmms.get(0); return gmm.getNgauss(); }
int getNcoefs() { GMMDiag gmm = hmmsHTK.gmms.get(0); return gmm.getNcoefs(); }
private void allocateWeights() { logMath = LogMath.getLogMath(); weights = new float[ngauss]; for (int i = 0; i < ngauss; i++) { setWeight(i, 1f / ngauss); } }
public void precomputeDistance() { for (int gidx = 0; gidx < ngauss; gidx++) { float fact = 0.0f; for (int i = 0; i < ncoefs; i++) { fact += logMath.linearToLog(getVar(gidx, i)); } fact += logMath.linearToLog(2.0 * Math.PI) * ncoefs; logPreComputedGaussianFactor[gidx] = fact * 0.5f; } }
public String[] getHMMnames() { String[] rep = new String[hmms.size()]; for (int i = 0; i < rep.length; i++) { SingleHMM h = hmms.get(i); rep[i] = h.getName(); } return rep; }