example.cc
来自「这是一个从音频信号里提取特征参量的程序」· CC 代码 · 共 72 行
CC
72 行
// file: $isip/doc/examples/class/stat/stat_example_01/example.cc// version: $Id: example.cc,v 1.1 2001/01/12 00:06:30 peng Exp $//// isip include files//#include <GaussianModel.h>#include <UniformModel.h>#include <MixtureModel.h>// main program starts here:// this example demonstrates how to use MixtureModel to combining several// statistical models for creation of mixture distributions//int main() { // declare the MixtureModel object // MixtureModel model; // declare GaussianModel and UniformModel objects // GaussianModel gauss; UniformModel uniform; // set the GaussianModel object // VectorFloat mean(L"1, 2, 3"); MatrixFloat covar(3, 3, L"4, 5, 6", Integral::DIAGONAL); gauss.setMean(mean); gauss.setCovariance(covar); // set the UniformModel object // VectorFloat min(L"-1, -2, -3"); VectorFloat max(L"1, 2, 3"); uniform.setMin(min); uniform.setMax(max); // add model objects into the MixtureModel object // model.add(gauss); model.add(uniform); // set the weights for two model objects // VectorFloat weights(L"0.3, 0.7"); model.setWeights(weights); // declare the input vector // VectorFloat input; input.assign(L"-0.9, -1.2, -2.3"); // score the input vector // Float score = model.getLikelihood(input); Float gauss_score = gauss.getLikelihood(input); Float uniform_score = uniform.getLikelihood(input); // output the result to the console output // gauss_score.debug(L"First model's score:"); uniform_score.debug(L"Second model's score:"); weights.debug(L"Weights for models:"); score.debug(L"Final score:"); // exit gracefully // Integral::exit();}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?