#include <iostream>#include <fstream>#include <cstdio>#include <cassert>#include <cmath>#include <liatools.h>#include <DoubleSquareMatrix.h>
Go to the source code of this file.
Defines | |
| #define | ALIZE_TrainTools_cpp |
Functions | |
| void | copyMixture (DistribGD &s, DistribGD &d) |
| unsigned long | selectComponent (bool selectCompA[], XList &distribL, MixtureGD &inputM) |
| unsigned long | selectComponent (bool selectCompA[], double wFactor, MixtureGD &inputM) |
| unsigned long | selectComponent (bool selectCompA[], unsigned long nbTop, MixtureGD &inputM) |
| double | reduceModel (bool selectCompA[], MixtureGD &inputM, MixtureGD &outputM) |
| void | normalizeWeights (MixtureGD &outputM) |
| void | fuseModels (const MixtureGD &model1, unsigned long nbFrameM1, const MixtureGD &model2, unsigned long nbFrameM2, MixtureGD &result) |
| void | gaussianFusion (const DistribGD &g1, double w1, const DistribGD &g2, double w2, DistribGD &res, double &w) |
| void | mixtureFusion (const MixtureGD &mixt, DistribGD &res, double &wres) |
| void | normalizeMixture (MixtureGD &mixt, const DoubleVector &meanSignal, const DoubleVector &covSignal, bool zeroOne, unsigned long nbIt, bool meanOnly, Config &config) |
| void | normalizeMixture (MixtureGD &mixt, const DoubleVector &meanSignal, const DoubleVector &covSignal, bool zeroOne, TrainCfg &trainCfg, Config &config) |
| void | normalizeMixture (MixtureGD &mixt, const DoubleVector &meanSignal, const DoubleVector covSignal, bool zeroOne, Config &config) |
| void | normalizeMixture (MixtureGD &mixt, TrainCfg &trainCfg, Config &config) |
| void | normalizeMixture (MixtureGD &mixt, Config &config) |
| void | normalizeMixture (MixtureGD &mixt, MAPCfg &mapCfg, Config &config) |
| double | likelihoodLoss (const DistribGD &g1, double w1, const DistribGD &g2, double w2) |
| void | computeMAPConst (const MixtureGD &initModel, MixtureGD &client, MAPCfg &cfg) |
| void | computeMAPConst2 (const MixtureGD &initModel, MixtureGD &client, MAPCfg &cfg) |
| void | copyMean (MixtureGD &mixtS, MixtureGD &mixtD) |
| void | copyVar (MixtureGD &mixtS, MixtureGD &mixtD) |
| void | copyWeight (MixtureGD &mixtS, MixtureGD &mixtD) |
| void | computeMAPOccDep (const MixtureGD &initModel, MixtureGD &client, MAPCfg &cfg, double frameCount) |
| void | computeModelBasedMAPOccDep (const MixtureGD &initModel, MixtureGD &client, MAPCfg &cfg, double frameCount) |
| void | computeMAP (MixtureServer &ms, const MixtureGD &initModel, MixtureGD &client, unsigned long frameCount, Config &config) |
| void | computeMAP (MixtureServer &ms, const MixtureGD &initModel, MixtureGD &client, unsigned long frameCount, MAPCfg &cfg) |
| double | setItParameter (double begin, double end, int nbIt, int it) |
| void | varianceControl (MixtureGD &model, double flooring, double ceiling, const DoubleVector &covSignal) |
| unsigned long | computeMeanCov (Config &config, FeatureServer **fsTab, SegCluster **segTab, unsigned long nbStream, DoubleVector &mean, DoubleVector &cov) |
| unsigned long | computeMeanCov (Config &config, FeatureServer &fs, SegCluster &seg, DoubleVector &mean, DoubleVector &cov) |
| void | initialize01 (unsigned long vectSize, DoubleVector &mean, DoubleVector &cov) |
| MixtureGD & | mixtureInit (MixtureServer &ms, FeatureServer &fs, MixtureGD &world, SegCluster &selectedSegments, const DoubleVector &globalCov, Config &config, TrainCfg &trainCfg) |
| MixtureGD & | mixtureInit (MixtureServer &ms, FeatureServer **fsTab, SegCluster **segTab, double *weightTab, unsigned long nbStream, MixtureGD &world, const DoubleVector &globalCov, Config &config, TrainCfg &trainCfg) |
| MixtureGD & | mixtureInit (MixtureServer &ms, FeatureServer &fs, MixtureGD &world, SegCluster &selectedSegments, const DoubleVector &globalCov, Config &config) |
| MixtureGD & | mixtureInit (MixtureServer &ms, FeatureServer **fsTab, SegCluster **segTab, double *weightTab, unsigned long nbStream, MixtureGD &world, const DoubleVector &globalCov, Config &config) |
| Matrix< double > | computeMLLR (MixtureGD &inM, MixtureGD &outM, unsigned long frameCount, Config &config) |
| void | adaptModel (Config &config, StatServer &ss, MixtureServer &ms, FeatureServer &fs, SegCluster &selectedSegments, MixtureGD &aprioriModel, MixtureGD &clientMixture, MAPCfg &mapCfg) |
| void | adaptModel (Config &config, StatServer &ss, MixtureServer &ms, FeatureServer &fs, SegCluster &selectedSegments, MixtureGD &aprioriModel, MixtureGD &clientMixture) |
| void | modelBasedadaptModel (Config &config, StatServer &ss, MixtureServer &ms, FeatureServer &fs, SegCluster &selectedSegments, MixtureGD &aprioriModel, MixtureGD &clientMixture, MixtureGD &initModel) |
| void | trainModel (Config &config, StatServer &ss, FeatureServer &fs, SegCluster &selectedSegments, DoubleVector &globalMean, DoubleVector &globalCov, MixtureGD &world, TrainCfg &trainCfg) |
| void | trainModelStream (Config &config, MixtureServer &ms, StatServer &ss, FeatureServer **fsTab, SegCluster **segTab, double *weightTab, unsigned long nbStream, DoubleVector &globalMean, DoubleVector &globalCov, MixtureGD *&world, TrainCfg &trainCfg) |
| void | trainModel (Config &config, StatServer &ss, FeatureServer &fs, SegCluster &selectedSegments, DoubleVector &globalMean, DoubleVector &globalCov, MixtureGD &world) |
| void | trainModel (Config &config, MixtureServer &ms, StatServer &ss, FeatureServer **fsTab, SegCluster **segTab, double *weightTab, unsigned long nbStream, DoubleVector &globalMean, DoubleVector &globalCov, MixtureGD *&world) |
| #define ALIZE_TrainTools_cpp |
Definition at line 56 of file TrainTools.cpp.
| void adaptModel | ( | Config & | config, |
| StatServer & | ss, | ||
| MixtureServer & | ms, | ||
| FeatureServer & | fs, | ||
| SegCluster & | selectedSegments, | ||
| MixtureGD & | aprioriModel, | ||
| MixtureGD & | clientMixture, | ||
| MAPCfg & | mapCfg | ||
| ) |
Definition at line 873 of file TrainTools.cpp.
References accumulateStatEM(), baggedSegments(), computeMAP(), computeMLLR(), debug, MAPCfg::getBaggedFrameProbability(), MAPCfg::getMethod(), MAPCfg::getNbTrainIt(), MAPCfg::getNormalizeModel(), meanLikelihood(), normalizeMixture(), MAPCfg::showConfig(), verbose, and verboseLevel.
| void adaptModel | ( | Config & | config, |
| StatServer & | ss, | ||
| MixtureServer & | ms, | ||
| FeatureServer & | fs, | ||
| SegCluster & | selectedSegments, | ||
| MixtureGD & | aprioriModel, | ||
| MixtureGD & | clientMixture | ||
| ) |
Definition at line 908 of file TrainTools.cpp.
References adaptModel().
Referenced by adaptModel(), clusteringCriterionByAdapt(), learnMAPimpostorModels(), TrainTarget(), TrainTargetAdapt(), and TrainTargetByLabel().
| void computeMAP | ( | MixtureServer & | ms, |
| const MixtureGD & | initModel, | ||
| MixtureGD & | client, | ||
| unsigned long | frameCount, | ||
| Config & | config | ||
| ) |
Definition at line 543 of file TrainTools.cpp.
References computeMAP().
Referenced by adaptModel(), adaptModelMAP(), computeMAP(), crossValid(), and modelBasedadaptModel().
| void computeMAP | ( | MixtureServer & | ms, |
| const MixtureGD & | initModel, | ||
| MixtureGD & | client, | ||
| unsigned long | frameCount, | ||
| MAPCfg & | cfg | ||
| ) |
Definition at line 548 of file TrainTools.cpp.
References computeMAPConst(), computeMAPConst2(), computeMAPOccDep(), computeModelBasedMAPOccDep(), debug, MAPCfg::getMethod(), and MAPCfg::showConfig().
| void computeMAPConst | ( | const MixtureGD & | initModel, |
| MixtureGD & | client, | ||
| MAPCfg & | cfg | ||
| ) |
Definition at line 356 of file TrainTools.cpp.
References MAPCfg::getMeanAdapt(), MAPCfg::getMeanAlpha(), MAPCfg::getVarAdapt(), and MAPCfg::getWeightAdapt().
Referenced by computeMAP().
| void computeMAPConst2 | ( | const MixtureGD & | initModel, |
| MixtureGD & | client, | ||
| MAPCfg & | cfg | ||
| ) |
Definition at line 390 of file TrainTools.cpp.
References MAPCfg::getMeanAdapt(), MAPCfg::getMeanAlpha(), MAPCfg::getVarAdapt(), and MAPCfg::getWeightAdapt().
Referenced by computeMAP().
| void computeMAPOccDep | ( | const MixtureGD & | initModel, |
| MixtureGD & | client, | ||
| MAPCfg & | cfg, | ||
| double | frameCount | ||
| ) |
Definition at line 447 of file TrainTools.cpp.
References MAPCfg::getMeanAdapt(), MAPCfg::getMeanReg(), MAPCfg::getVarAdapt(), MAPCfg::getVarReg(), MAPCfg::getWeightAdapt(), MAPCfg::getWeightReg(), MAPCfg::showConfig(), and verbose.
Referenced by computeMAP().
| unsigned long computeMeanCov | ( | Config & | config, |
| FeatureServer ** | fsTab, | ||
| SegCluster ** | segTab, | ||
| unsigned long | nbStream, | ||
| DoubleVector & | mean, | ||
| DoubleVector & | cov | ||
| ) |
Definition at line 595 of file TrainTools.cpp.
References accumulateStatFrame(), and initialize01().
Referenced by normFeat(), and trainWorld().
| unsigned long computeMeanCov | ( | Config & | config, |
| FeatureServer & | fs, | ||
| SegCluster & | seg, | ||
| DoubleVector & | mean, | ||
| DoubleVector & | cov | ||
| ) |
Definition at line 605 of file TrainTools.cpp.
References accumulateStatFrame(), and initialize01().
| Matrix<double> computeMLLR | ( | MixtureGD & | inM, |
| MixtureGD & | outM, | ||
| unsigned long | frameCount, | ||
| Config & | config | ||
| ) |
Definition at line 790 of file TrainTools.cpp.
References copyVar(), copyWeight(), verbose, and verboseLevel.
Referenced by adaptModel().
| void computeModelBasedMAPOccDep | ( | const MixtureGD & | initModel, |
| MixtureGD & | client, | ||
| MAPCfg & | cfg, | ||
| double | frameCount | ||
| ) |
Definition at line 493 of file TrainTools.cpp.
References MAPCfg::getMeanAdapt(), MAPCfg::getMeanReg(), MAPCfg::getVarAdapt(), MAPCfg::getVarReg(), MAPCfg::getWeightAdapt(), MAPCfg::getWeightReg(), MAPCfg::showConfig(), and verbose.
Referenced by computeMAP().
| void copyMean | ( | MixtureGD & | mixtS, |
| MixtureGD & | mixtD | ||
| ) |
Definition at line 423 of file TrainTools.cpp.
| void copyMixture | ( | DistribGD & | s, |
| DistribGD & | d | ||
| ) |
Definition at line 166 of file TrainTools.cpp.
Referenced by reduceModel().
| void copyVar | ( | MixtureGD & | mixtS, |
| MixtureGD & | mixtD | ||
| ) |
Definition at line 432 of file TrainTools.cpp.
Referenced by computeMLLR().
| void copyWeight | ( | MixtureGD & | mixtS, |
| MixtureGD & | mixtD | ||
| ) |
Definition at line 441 of file TrainTools.cpp.
Referenced by computeMLLR().
| void fuseModels | ( | const MixtureGD & | model1, |
| unsigned long | nbFrameM1, | ||
| const MixtureGD & | model2, | ||
| unsigned long | nbFrameM2, | ||
| MixtureGD & | result | ||
| ) |
Definition at line 236 of file TrainTools.cpp.
Referenced by computeMAPmodelFromEMones().
| void gaussianFusion | ( | const DistribGD & | g1, |
| double | w1, | ||
| const DistribGD & | g2, | ||
| double | w2, | ||
| DistribGD & | res, | ||
| double & | w | ||
| ) |
Definition at line 257 of file TrainTools.cpp.
Referenced by mixtureFusion().
| void initialize01 | ( | unsigned long | vectSize, |
| DoubleVector & | mean, | ||
| DoubleVector & | cov | ||
| ) |
Definition at line 614 of file TrainTools.cpp.
Referenced by computeMeanCov(), and trainWorld().
| double likelihoodLoss | ( | const DistribGD & | g1, |
| double | w1, | ||
| const DistribGD & | g2, | ||
| double | w2 | ||
| ) |
Definition at line 338 of file TrainTools.cpp.
Referenced by energyDetector().
| void mixtureFusion | ( | const MixtureGD & | mixt, |
| DistribGD & | res, | ||
| double & | wres | ||
| ) |
Definition at line 271 of file TrainTools.cpp.
References gaussianFusion().
Referenced by normalizeMixture().
| MixtureGD& mixtureInit | ( | MixtureServer & | ms, |
| FeatureServer ** | fsTab, | ||
| SegCluster ** | segTab, | ||
| double * | weightTab, | ||
| unsigned long | nbStream, | ||
| MixtureGD & | world, | ||
| const DoubleVector & | globalCov, | ||
| Config & | config, | ||
| TrainCfg & | trainCfg | ||
| ) |
Definition at line 676 of file TrainTools.cpp.
References accumulateStatFrame(), baggedSegments(), debug, totalFrame(), and verbose.
| MixtureGD& mixtureInit | ( | MixtureServer & | ms, |
| FeatureServer & | fs, | ||
| MixtureGD & | world, | ||
| SegCluster & | selectedSegments, | ||
| const DoubleVector & | globalCov, | ||
| Config & | config | ||
| ) |
Definition at line 769 of file TrainTools.cpp.
References mixtureInit().
Referenced by clusteringCriterionWithoutWorldInit(), mixtureInit(), and trainWorld().
| MixtureGD& mixtureInit | ( | MixtureServer & | ms, |
| FeatureServer ** | fsTab, | ||
| SegCluster ** | segTab, | ||
| double * | weightTab, | ||
| unsigned long | nbStream, | ||
| MixtureGD & | world, | ||
| const DoubleVector & | globalCov, | ||
| Config & | config | ||
| ) |
Definition at line 774 of file TrainTools.cpp.
References mixtureInit().
| MixtureGD& mixtureInit | ( | MixtureServer & | ms, |
| FeatureServer & | fs, | ||
| MixtureGD & | world, | ||
| SegCluster & | selectedSegments, | ||
| const DoubleVector & | globalCov, | ||
| Config & | config, | ||
| TrainCfg & | trainCfg | ||
| ) |
Definition at line 621 of file TrainTools.cpp.
References accumulateStatFrame(), baggedSegments(), TrainCfg::getBaggedFrameProbabilityInit(), and verbose.
| void modelBasedadaptModel | ( | Config & | config, |
| StatServer & | ss, | ||
| MixtureServer & | ms, | ||
| FeatureServer & | fs, | ||
| SegCluster & | selectedSegments, | ||
| MixtureGD & | aprioriModel, | ||
| MixtureGD & | clientMixture, | ||
| MixtureGD & | initModel | ||
| ) |
Definition at line 917 of file TrainTools.cpp.
References accumulateStatEM(), baggedSegments(), computeMAP(), debug, MAPCfg::getBaggedFrameProbability(), MAPCfg::getNbEmIt(), MAPCfg::getNormalizeModel(), likelihoodGD(), meanLikelihood(), normalizeMixture(), MAPCfg::showConfig(), totalFrame(), verbose, and verboseLevel.
Referenced by TrainTarget().
| void normalizeMixture | ( | MixtureGD & | mixt, |
| MAPCfg & | mapCfg, | ||
| Config & | config | ||
| ) |
Definition at line 334 of file TrainTools.cpp.
References MAPCfg::getNormalizeModelMeanOnly(), MAPCfg::getNormalizeModelNbIt(), and normalizeMixture().
| void normalizeMixture | ( | MixtureGD & | mixt, |
| const DoubleVector & | meanSignal, | ||
| const DoubleVector & | covSignal, | ||
| bool | zeroOne, | ||
| unsigned long | nbIt, | ||
| bool | meanOnly, | ||
| Config & | config | ||
| ) |
Definition at line 287 of file TrainTools.cpp.
References mixtureFusion().
Referenced by adaptModel(), adaptModelMAP(), crossValid(), modelBasedadaptModel(), normalizeMixture(), trainModel(), and trainModelStream().
| void normalizeMixture | ( | MixtureGD & | mixt, |
| const DoubleVector & | meanSignal, | ||
| const DoubleVector & | covSignal, | ||
| bool | zeroOne, | ||
| TrainCfg & | trainCfg, | ||
| Config & | config | ||
| ) |
Definition at line 316 of file TrainTools.cpp.
References TrainCfg::getNormalizeModelMeanOnly(), TrainCfg::getNormalizeModelNbIt(), and normalizeMixture().
| void normalizeMixture | ( | MixtureGD & | mixt, |
| const DoubleVector & | meanSignal, | ||
| const DoubleVector | covSignal, | ||
| bool | zeroOne, | ||
| Config & | config | ||
| ) |
Definition at line 319 of file TrainTools.cpp.
References normalizeMixture().
| void normalizeMixture | ( | MixtureGD & | mixt, |
| TrainCfg & | trainCfg, | ||
| Config & | config | ||
| ) |
Definition at line 325 of file TrainTools.cpp.
References normalizeMixture().
| void normalizeMixture | ( | MixtureGD & | mixt, |
| Config & | config | ||
| ) |
Definition at line 329 of file TrainTools.cpp.
References normalizeMixture().
| void normalizeWeights | ( | MixtureGD & | outputM ) |
Definition at line 223 of file TrainTools.cpp.
Referenced by trainModelStream().
| double reduceModel | ( | bool | selectCompA[], |
| MixtureGD & | inputM, | ||
| MixtureGD & | outputM | ||
| ) |
Definition at line 206 of file TrainTools.cpp.
References copyMixture().
Referenced by trainModelStream().
| unsigned long selectComponent | ( | bool | selectCompA[], |
| unsigned long | nbTop, | ||
| MixtureGD & | inputM | ||
| ) |
Definition at line 197 of file TrainTools.cpp.
References TabWeight::getDistrib().
| unsigned long selectComponent | ( | bool | selectCompA[], |
| XList & | distribL, | ||
| MixtureGD & | inputM | ||
| ) |
Definition at line 175 of file TrainTools.cpp.
Referenced by trainModelStream().
| unsigned long selectComponent | ( | bool | selectCompA[], |
| double | wFactor, | ||
| MixtureGD & | inputM | ||
| ) |
Definition at line 186 of file TrainTools.cpp.
| double setItParameter | ( | double | begin, |
| double | end, | ||
| int | nbIt, | ||
| int | it | ||
| ) |
Definition at line 562 of file TrainTools.cpp.
Referenced by trainModel(), and trainModelStream().
| void trainModel | ( | Config & | config, |
| MixtureServer & | ms, | ||
| StatServer & | ss, | ||
| FeatureServer ** | fsTab, | ||
| SegCluster ** | segTab, | ||
| double * | weightTab, | ||
| unsigned long | nbStream, | ||
| DoubleVector & | globalMean, | ||
| DoubleVector & | globalCov, | ||
| MixtureGD *& | world | ||
| ) |
Definition at line 1118 of file TrainTools.cpp.
References TrainCfg::showConfig(), trainModelStream(), and verbose.
| void trainModel | ( | Config & | config, |
| StatServer & | ss, | ||
| FeatureServer & | fs, | ||
| SegCluster & | selectedSegments, | ||
| DoubleVector & | globalMean, | ||
| DoubleVector & | globalCov, | ||
| MixtureGD & | world, | ||
| TrainCfg & | trainCfg | ||
| ) |
Definition at line 995 of file TrainTools.cpp.
References accumulateStatEM(), baggedSegments(), TrainCfg::getBaggedFrameProbability(), TrainCfg::getFinalVarCeil(), TrainCfg::getFinalVarFloor(), TrainCfg::getInitVarCeil(), TrainCfg::getInitVarFloor(), TrainCfg::getNbTrainIt(), TrainCfg::getNormalizeModel(), meanLikelihood(), normalizeMixture(), setItParameter(), TrainCfg::showConfig(), varianceControl(), verbose, and verboseLevel.
| void trainModel | ( | Config & | config, |
| StatServer & | ss, | ||
| FeatureServer & | fs, | ||
| SegCluster & | selectedSegments, | ||
| DoubleVector & | globalMean, | ||
| DoubleVector & | globalCov, | ||
| MixtureGD & | world | ||
| ) |
Definition at line 1113 of file TrainTools.cpp.
References trainModel().
Referenced by clusteringCriterion(), clusteringCriterionWithoutWorldInit(), and trainModel().
| void trainModelStream | ( | Config & | config, |
| MixtureServer & | ms, | ||
| StatServer & | ss, | ||
| FeatureServer ** | fsTab, | ||
| SegCluster ** | segTab, | ||
| double * | weightTab, | ||
| unsigned long | nbStream, | ||
| DoubleVector & | globalMean, | ||
| DoubleVector & | globalCov, | ||
| MixtureGD *& | world, | ||
| TrainCfg & | trainCfg | ||
| ) |
Definition at line 1032 of file TrainTools.cpp.
References accumulateStatEM(), baggedSegments(), debug, TrainCfg::getBaggedFrameProbability(), TrainCfg::getComponentReduction(), TrainCfg::getFinalVarCeil(), TrainCfg::getFinalVarFloor(), TrainCfg::getInitVarCeil(), TrainCfg::getInitVarFloor(), TrainCfg::getNbTrainIt(), TrainCfg::getNormalizeModel(), TrainCfg::getTargetDistribCount(), meanLikelihood(), normalizeMixture(), normalizeWeights(), reduceModel(), selectComponent(), setItParameter(), TrainCfg::showConfig(), totalFrame(), varianceControl(), verbose, and verboseLevel.
Referenced by trainModel(), and trainWorld().
| void varianceControl | ( | MixtureGD & | model, |
| double | flooring, | ||
| double | ceiling, | ||
| const DoubleVector & | covSignal | ||
| ) |
Definition at line 569 of file TrainTools.cpp.
References verbose.
Referenced by energyDetector(), trainModel(), and trainModelStream().
1.7.2