📄 example.cc
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -