⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hmm_09.cc

📁 这是一个从音频信号里提取特征参量的程序
💻 CC
字号:
// file: $isip/class/pr/HiddenMarkovModel/hmm_09.cc// version: $Id: hmm_09.cc,v 1.1 2003/01/11 15:20:59 jelinek Exp $//// isip include files//#include "HiddenMarkovModel.h"// method: adaptPart//// arguments://  Vector<MatrixDouble>& g: (output) vector of G matrices//  MatrixFloat& z: (output) Z matrix//  GaussianModel& gm: (input) Gaussian model with its statistics//// return: a boolean value indicating status//// this method computes contribution of one Gaussian model to// cumulative adaptation matrices G and Z//boolean HiddenMarkovModel::adaptPart(Vector<MatrixDouble>& g_a,				     MatrixFloat& z_a,				     GaussianModel& gm_a) {  // print the access count in debug mode  //  if (debug_level_d >= Integral::ALL) {    String out(L"access count:");    out.concat(gm_a.getAccessCount());    Console::put(out);  }  // if model was accessed, compute its contribution to the global  // adaptation and add it to the global adaptation matrices  //  if (gm_a.getAccessCount() > 0) {    // form the extended mean    //    VectorFloat extended_mean;    gm_a.getMean(extended_mean);    long num_feat = extended_mean.length();    extended_mean.setLength(num_feat + 1);    for (long i = num_feat; i > 0; i--) {      extended_mean(i) = extended_mean(i - 1);    }    extended_mean(0) = 1;    // inverse the covariance matrix    //    MatrixFloat inv_cov;    gm_a.getCovariance(inv_cov);    inv_cov.inverse();          // convert mean accumulator to float    //    VectorDouble mean_accum;    gm_a.getMeanAccumulator(mean_accum);    VectorFloat mean_accum_f(num_feat);    for (long i = 0; i < num_feat; i++) {      mean_accum_f(i) = (Float)mean_accum(i);    }    // compute contribution of this model to the matrix Z    //    VectorFloat tmp;    inv_cov.multv(tmp, mean_accum_f);    MatrixFloat z_r;    z_r.outerProduct(tmp, extended_mean);    z_a.add(z_r);    // compute V matrix    //    MatrixFloat v(inv_cov);    Double occup_accum = gm_a.getOccupancy();    v.mult((float)occup_accum);    // compute D matrix    //    MatrixFloat d;    d.outerProduct(extended_mean, extended_mean);    // check for the diagonal covariance before computing G matrix    //    if (!inv_cov.isDiagonal()) {      return Error::handle(name(),			   L"adapt - only diagonal matrices supported",			   Error::ARG, __FILE__, __LINE__);    }        // compute contribution of this model to the matrix G    //    MatrixFloat g_r;    for (long i = 0; i < num_feat; i++) {      g_r.assign(d);      g_r.mult(v(i, i));      g_a(i).add(g_r);    }    // exit gracefully    //    return true;  }  // else the model was not accessed  //  else {        // exit ungracefully    //    return false;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -