Classes | Defines | Functions

UnsupervisedTools.cpp File Reference

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <liatools.h>
#include <DoubleSquareMatrix.h>
#include <RealVector.h>
#include "FileInfo.h"
#include "UnsupervisedTools.h"
Include dependency graph for UnsupervisedTools.cpp:

Go to the source code of this file.

Classes

class  WindowLLR
class  Norm

Defines

#define ALIZE_UnsupervisedTools_cpp

Functions

void accumulateStatLK (StatServer &ss, FeatureServer &fs, MixtureStat &acc, unsigned long idxBeginFrame, unsigned long nbFrames, Config &config)
void accumulateStatLK (StatServer &ss, FeatureServer &fs, MixtureStat &acc, Seg *seg, Config &config)
void accumulateStatLK (StatServer &ss, FeatureServer &fs, MixtureStat &acc, SegCluster &selectedSegments, Config &config)
void adaptModel (Config &config, StatServer &ss, MixtureServer &ms, ObjectRefVector &FeatServ, ObjectRefVector &ClusterSeg, MixtureGD &aprioriModel, MixtureGD &clientMixture, DoubleVector &decision)
void modelBasedadaptModelEM (Config &config, StatServer &ss, MixtureServer &ms, FeatureServer &fs, SegCluster &selectedSegments, FeatureServer &fsTests, SegCluster &selectedSegmentsTests, MixtureGD &aprioriModel, MixtureGD &clientMixture, MixtureGD &initModel)
void modelBasedadaptModelEM (Config &config, StatServer &ss, MixtureServer &ms, FeatureServer &fs, SegCluster &selectedSegments, MixtureGD &aprioriModel, MixtureGD &clientMixture, MixtureGD &initModel)
void adaptModelMAP (Config &config, StatServer &ss, MixtureServer &ms, MixtureGD &aprioriModel, MixtureGD &clientMixture, MAPCfg &mapCfg, unsigned long &frameCount)
void adaptModelMAP (Config &config, StatServer &ss, MixtureServer &ms, MixtureGD &aprioriModel, MixtureGD &clientMixture, unsigned long &frameCount)
void adaptModelEM (Config &config, StatServer &ss, MixtureServer &ms, FeatureServer &fs, SegCluster &selectedSegments, MixtureGD &aprioriModel, MixtureGD &clientMixture, MAPCfg &mapCfg)
void adaptModelEM (Config &config, StatServer &ss, MixtureServer &ms, FeatureServer &fs, SegCluster &selectedSegments, MixtureGD &aprioriModel, MixtureGD &clientMixture)
void adaptModelEM (Config &config, StatServer &ss, MixtureServer &ms, FeatureServer &fs, SegCluster &selectedSegments, FeatureServer &fs2, SegCluster &selectedSegments2, MixtureGD &aprioriModel, MixtureGD &clientMixture, MAPCfg &mapCfg)
void adaptModelEM (Config &config, StatServer &ss, MixtureServer &ms, FeatureServer &fs, SegCluster &selectedSegments, FeatureServer &fs2, SegCluster &selectedSegments2, MixtureGD &aprioriModel, MixtureGD &clientMixture)
double computeLLR (StatServer &ss, FeatureServer &fsTests, MixtureGD &world, MixtureGD &clientMixture, SegCluster &selectedSegmentsTests)
double computeLLR (Config &config, StatServer &ss, FeatureServer &fsTests, MixtureGD &world, MixtureGD &clientMixture, SegCluster &selectedSegmentsTests, String &idTest)
double computeFastLLR (StatServer &ss, FeatureServer &fsTests, MixtureGD &world, MixtureGD &clientMixture, SegCluster &selectedSegmentsTests, String &idTest, Config &config)
double computeLLRGD (Config &config, MixtureGD &clientMixture, MixtureGD &world, MixtureGD &dataTest)
void expandLLR (DoubleVector &decision, Config &configTest)
void WMAP (DoubleVector &decision, Config &configTest)
String getFullFileName (String &id, Config &c)
String getFullMixtureName (String &id, Config &c)
bool FileExists (String &fullFileName)
void WMAPGMMFixedPriors (DoubleVector &decision, Config &configTest, MixtureGD &tar, MixtureGD &non, StatServer &ss)
void WMAPGMM (DoubleVector &decision, Config &configTest, MixtureGD &tar, MixtureGD &non, StatServer &ss)
void computePriors (DoubleVector &decision, DoubleVector &priorImp, DoubleVector &priorTar, Config &configTest)
void computeMAPmodelFromEMones (Config &config, StatServer &ss, MixtureServer &ms, DoubleVector &nbFramesSelected, MixtureGD &aprioriModel, MixtureGD &clientMixture, MixtureGD &aux, MixtureGD &tmp, DoubleVector &decision, XLine &testsToCompute)
double SegClusterFrame (SegCluster &SegC)
void loadTnormParam (String &inputTestListFileName, String &testFileTnorm, ObjectRefVector &stockTnorm, Config &config)
void normalizeScore (String &test, double &decision, ObjectRefVector &stockNorm)
void normalizeScore (String &test, double &decision, ObjectRefVector &stockNorm, double &shift)
void computeAndStoreZnormParam (StatServer &ss, String &inputImpListFileName, String &idclient, MixtureGD &clientMixture, ObjectRefVector &stockZnorm, MixtureGD &world, Config &config, bool &ztnorm, ObjectRefVector &stockTnorm)
void resetWeights (DoubleVector &decision)
void Oracle (String &idTar, String &idTest, double &score, Config &config, MixtureGD &tar, MixtureGD &non, StatServer &ss)
void crossValid (Config &configTest, StatServer &ss, MixtureServer &ms, FeatureServer &fs, SegCluster &selectedSegments, MixtureGD &aprioriModel, MixtureGD &bestModel, SegCluster &selectedSegmentsBagged, String &idTest)
double searchLLRFromResFile (String &idTar, String &test, String &inputResFilename, Config &config)
unsigned long adaptModelEMweightedFrames (String &labelSelectedFrames, XLine &featureFileName, StatServer &ss, MixtureGD &world, MixtureGD &tar, MixtureGD &non, MixtureGD &MixtureforLLR, MixtureGD &MixtureEMOutput, Config &config, FeatureServer &fs, String &fullFileName, String &idTest)
String selectNearestTarModel (String &TARListFilename, String &fullFileName, Config &config, StatServer &ss, FeatureServer &fs, MixtureGD &world, SegCluster &selectedSegments, MixtureServer &ms)
void computeLLRmatrix (DoubleMatrix &LLR, XLine &models, XList &features, Config &config, StatServer &ss, MixtureGD &world, MixtureServer &ms, String &labelSelectedFrames)
void addLineInXList (XLine &line, XList &list)
void fuseMAP (Config &config, StatServer &ss, MixtureServer &ms, MixtureGD &aprioriModel, MixtureGD &clientMixture, MixtureGD &aux, MixtureGD &tmp, DoubleVector &decision, XLine &testsToCompute)
void fuseMAPMeans (const MixtureGD &model1, double &w1, const MixtureGD &model2, double &w2, MixtureGD &result)
double computeWeightedLLR (Config &config, StatServer &ss, FeatureServer &fsTests, MixtureServer &ms, MixtureGD &aprioriModel, SegCluster &selectedSegmentsTests, MixtureGD &aux, DoubleVector &decision, XLine &testsToCompute, String &idTest, String &fullFileName)
void copyCluster (SegCluster &source, SegCluster &dest)
int findClusterInRefvector (ObjectRefVector &SegServ, String &id)
void learnEMimpostorModels (Config &config, DoubleVector &NbFramesSelectedImp, MixtureServer &ms, StatServer &ss, MixtureGD &world)
void learnMAPimpostorModels (Config &config, DoubleVector &NbFramesSelectedImp, MixtureServer &ms, StatServer &ss, MixtureGD &world)
double computeAdaptedTnorm (Config &configTest, MixtureServer &ms, StatServer &ss, MixtureGD &world, MixtureGD &auxMixture, MixtureGD &tmpMixture, double &nonorm_score, int &countTests, DoubleVector &decision, DoubleVector &NbFramesSelected, XLine &testsToCompute, DoubleVector &NbFramesSelectedImp, FeatureServer &fsTests, SegCluster &selectedSegmentsTests, String &idTest)
double findNearestLLRInMatrix (Matrix< double > &Mat, unsigned long &index, double &LLR)
void assessAdaptation (StatServer &ss, MixtureGD &adaptedMixture, SegCluster &selectedSegments, Config &configTest, FeatureServer &fs, MixtureGD &world, DoubleVector &tmp, String &fullFileNameTrain, int countTests, double &tarScore)
void divDetect (double &LLRbaseline, double &LLRadapted, double &thresBaseline, double &thresAdapted)

Define Documentation

#define ALIZE_UnsupervisedTools_cpp

Definition at line 56 of file UnsupervisedTools.cpp.


Function Documentation

void accumulateStatLK ( StatServer &  ss,
FeatureServer &  fs,
MixtureStat &  acc,
unsigned long  idxBeginFrame,
unsigned long  nbFrames,
Config &  config 
)

Definition at line 180 of file UnsupervisedTools.cpp.

Referenced by accumulateStatLK().

void accumulateStatLK ( StatServer &  ss,
FeatureServer &  fs,
MixtureStat &  acc,
Seg *  seg,
Config &  config 
)

Definition at line 195 of file UnsupervisedTools.cpp.

References accumulateStatLK().

void accumulateStatLK ( StatServer &  ss,
FeatureServer &  fs,
MixtureStat &  acc,
SegCluster &  selectedSegments,
Config &  config 
)

Definition at line 203 of file UnsupervisedTools.cpp.

References accumulateStatLK().

void adaptModel ( Config &  config,
StatServer &  ss,
MixtureServer &  ms,
ObjectRefVector &  FeatServ,
ObjectRefVector &  ClusterSeg,
MixtureGD &  aprioriModel,
MixtureGD &  clientMixture,
DoubleVector &  decision 
)
void adaptModelEM ( Config &  config,
StatServer &  ss,
MixtureServer &  ms,
FeatureServer &  fs,
SegCluster &  selectedSegments,
MixtureGD &  aprioriModel,
MixtureGD &  clientMixture,
MAPCfg mapCfg 
)
void adaptModelEM ( Config &  config,
StatServer &  ss,
MixtureServer &  ms,
FeatureServer &  fs,
SegCluster &  selectedSegments,
MixtureGD &  aprioriModel,
MixtureGD &  clientMixture 
)

Definition at line 622 of file UnsupervisedTools.cpp.

References adaptModelEM().

Referenced by adaptModelEM(), learnEMimpostorModels(), and TrainTargetAdapt().

void adaptModelEM ( Config &  config,
StatServer &  ss,
MixtureServer &  ms,
FeatureServer &  fs,
SegCluster &  selectedSegments,
FeatureServer &  fs2,
SegCluster &  selectedSegments2,
MixtureGD &  aprioriModel,
MixtureGD &  clientMixture,
MAPCfg mapCfg 
)
void adaptModelEM ( Config &  config,
StatServer &  ss,
MixtureServer &  ms,
FeatureServer &  fs,
SegCluster &  selectedSegments,
FeatureServer &  fs2,
SegCluster &  selectedSegments2,
MixtureGD &  aprioriModel,
MixtureGD &  clientMixture 
)

Definition at line 692 of file UnsupervisedTools.cpp.

References adaptModelEM().

unsigned long adaptModelEMweightedFrames ( String &  labelSelectedFrames,
XLine &  featureFileName,
StatServer &  ss,
MixtureGD &  world,
MixtureGD &  tar,
MixtureGD &  non,
MixtureGD &  MixtureforLLR,
MixtureGD &  MixtureEMOutput,
Config &  config,
FeatureServer &  fs,
String &  fullFileName,
String &  idTest 
)
void adaptModelMAP ( Config &  config,
StatServer &  ss,
MixtureServer &  ms,
MixtureGD &  aprioriModel,
MixtureGD &  clientMixture,
unsigned long &  frameCount 
)

Definition at line 561 of file UnsupervisedTools.cpp.

References adaptModelMAP().

Referenced by adaptModelMAP(), and computeMAPmodelFromEMones().

void adaptModelMAP ( Config &  config,
StatServer &  ss,
MixtureServer &  ms,
MixtureGD &  aprioriModel,
MixtureGD &  clientMixture,
MAPCfg mapCfg,
unsigned long &  frameCount 
)
void addLineInXList ( XLine &  line,
XList &  list 
)

Definition at line 1733 of file UnsupervisedTools.cpp.

void assessAdaptation ( StatServer &  ss,
MixtureGD &  adaptedMixture,
SegCluster &  selectedSegments,
Config &  configTest,
FeatureServer &  fs,
MixtureGD &  world,
DoubleVector &  tmp,
String &  fullFileNameTrain,
int  countTests,
double &  tarScore 
)

Definition at line 2033 of file UnsupervisedTools.cpp.

References computeFastLLR().

Referenced by TrainTargetAdapt().

double computeAdaptedTnorm ( Config &  configTest,
MixtureServer &  ms,
StatServer &  ss,
MixtureGD &  world,
MixtureGD &  auxMixture,
MixtureGD &  tmpMixture,
double &  nonorm_score,
int &  countTests,
DoubleVector &  decision,
DoubleVector &  NbFramesSelected,
XLine &  testsToCompute,
DoubleVector &  NbFramesSelectedImp,
FeatureServer &  fsTests,
SegCluster &  selectedSegmentsTests,
String &  idTest 
)

Definition at line 1963 of file UnsupervisedTools.cpp.

References computeFastLLR(), computeMAPmodelFromEMones(), and line.

void computeAndStoreZnormParam ( StatServer &  ss,
String &  inputImpListFileName,
String &  idclient,
MixtureGD &  clientMixture,
ObjectRefVector &  stockZnorm,
MixtureGD &  world,
Config &  config,
bool &  ztnorm,
ObjectRefVector &  stockTnorm 
)
double computeFastLLR ( StatServer &  ss,
FeatureServer &  fsTests,
MixtureGD &  world,
MixtureGD &  clientMixture,
SegCluster &  selectedSegmentsTests,
String &  idTest,
Config &  config 
)
double computeLLR ( StatServer &  ss,
FeatureServer &  fsTests,
MixtureGD &  world,
MixtureGD &  clientMixture,
SegCluster &  selectedSegmentsTests 
)
double computeLLR ( Config &  config,
StatServer &  ss,
FeatureServer &  fsTests,
MixtureGD &  world,
MixtureGD &  clientMixture,
SegCluster &  selectedSegmentsTests,
String &  idTest 
)
double computeLLRGD ( Config &  config,
MixtureGD &  clientMixture,
MixtureGD &  world,
MixtureGD &  dataTest 
)

Definition at line 852 of file UnsupervisedTools.cpp.

References likelihoodGD(), verbose, and verboseLevel.

void computeLLRmatrix ( DoubleMatrix &  LLR,
XLine &  models,
XList &  features,
Config &  config,
StatServer &  ss,
MixtureGD &  world,
MixtureServer &  ms,
String &  labelSelectedFrames 
)
void computeMAPmodelFromEMones ( Config &  config,
StatServer &  ss,
MixtureServer &  ms,
DoubleVector &  nbFramesSelected,
MixtureGD &  aprioriModel,
MixtureGD &  clientMixture,
MixtureGD &  aux,
MixtureGD &  tmp,
DoubleVector &  decision,
XLine &  testsToCompute 
)

Definition at line 1130 of file UnsupervisedTools.cpp.

References adaptModelMAP(), debug, fuseModels(), verbose, and verboseLevel.

Referenced by computeAdaptedTnorm(), and TrainTargetAdapt().

void computePriors ( DoubleVector &  decision,
DoubleVector &  priorImp,
DoubleVector &  priorTar,
Config &  configTest 
)

Definition at line 1089 of file UnsupervisedTools.cpp.

References verbose, and verboseLevel.

Referenced by WMAPGMM().

double computeWeightedLLR ( Config &  config,
StatServer &  ss,
FeatureServer &  fsTests,
MixtureServer &  ms,
MixtureGD &  aprioriModel,
SegCluster &  selectedSegmentsTests,
MixtureGD &  aux,
DoubleVector &  decision,
XLine &  testsToCompute,
String &  idTest,
String &  fullFileName 
)

Definition at line 1804 of file UnsupervisedTools.cpp.

References computeFastLLR(), debug, verbose, and verboseLevel.

void copyCluster ( SegCluster &  source,
SegCluster &  dest 
)

Definition at line 1831 of file UnsupervisedTools.cpp.

Referenced by crossValid(), and TrainTargetAdapt().

void crossValid ( Config &  configTest,
StatServer &  ss,
MixtureServer &  ms,
FeatureServer &  fs,
SegCluster &  selectedSegments,
MixtureGD &  aprioriModel,
MixtureGD &  bestModel,
SegCluster &  selectedSegmentsBagged,
String &  idTest 
)
void divDetect ( double &  LLRbaseline,
double &  LLRadapted,
double &  thresBaseline,
double &  thresAdapted 
)

Definition at line 2081 of file UnsupervisedTools.cpp.

void expandLLR ( DoubleVector &  decision,
Config &  configTest 
)

Definition at line 874 of file UnsupervisedTools.cpp.

Referenced by TrainTargetAdapt().

bool FileExists ( String &  fullFileName )
int findClusterInRefvector ( ObjectRefVector &  SegServ,
String &  id 
)

Definition at line 1839 of file UnsupervisedTools.cpp.

double findNearestLLRInMatrix ( Matrix< double > &  Mat,
unsigned long &  index,
double &  LLR 
)

Definition at line 2005 of file UnsupervisedTools.cpp.

Referenced by TrainTargetAdapt().

void fuseMAP ( Config &  config,
StatServer &  ss,
MixtureServer &  ms,
MixtureGD &  aprioriModel,
MixtureGD &  clientMixture,
MixtureGD &  aux,
MixtureGD &  tmp,
DoubleVector &  decision,
XLine &  testsToCompute 
)

Definition at line 1751 of file UnsupervisedTools.cpp.

References debug, fuseMAPMeans(), verbose, and verboseLevel.

Referenced by TrainTargetAdapt().

void fuseMAPMeans ( const MixtureGD &  model1,
double &  w1,
const MixtureGD &  model2,
double &  w2,
MixtureGD &  result 
)

Definition at line 1784 of file UnsupervisedTools.cpp.

Referenced by fuseMAP().

String getFullFileName ( String &  id,
Config &  c 
)

Definition at line 952 of file UnsupervisedTools.cpp.

Referenced by computeAndStoreZnormParam(), and TrainTargetAdapt().

String getFullMixtureName ( String &  id,
Config &  c 
)
void learnEMimpostorModels ( Config &  config,
DoubleVector &  NbFramesSelectedImp,
MixtureServer &  ms,
StatServer &  ss,
MixtureGD &  world 
)
void learnMAPimpostorModels ( Config &  config,
DoubleVector &  NbFramesSelectedImp,
MixtureServer &  ms,
StatServer &  ss,
MixtureGD &  world 
)
void loadTnormParam ( String &  inputTestListFileName,
String &  testFileTnorm,
ObjectRefVector &  stockTnorm,
Config &  config 
)

Definition at line 1211 of file UnsupervisedTools.cpp.

References debug, Norm::idTest, line, Norm::mu, and Norm::sigma.

Referenced by TrainTargetAdapt().

void modelBasedadaptModelEM ( Config &  config,
StatServer &  ss,
MixtureServer &  ms,
FeatureServer &  fs,
SegCluster &  selectedSegments,
FeatureServer &  fsTests,
SegCluster &  selectedSegmentsTests,
MixtureGD &  aprioriModel,
MixtureGD &  clientMixture,
MixtureGD &  initModel 
)
void modelBasedadaptModelEM ( Config &  config,
StatServer &  ss,
MixtureServer &  ms,
FeatureServer &  fs,
SegCluster &  selectedSegments,
MixtureGD &  aprioriModel,
MixtureGD &  clientMixture,
MixtureGD &  initModel 
)
void normalizeScore ( String &  test,
double &  decision,
ObjectRefVector &  stockNorm,
double &  shift 
)

Definition at line 1284 of file UnsupervisedTools.cpp.

References verbose, and verboseLevel.

void normalizeScore ( String &  test,
double &  decision,
ObjectRefVector &  stockNorm 
)

Definition at line 1264 of file UnsupervisedTools.cpp.

References verbose, and verboseLevel.

Referenced by computeAndStoreZnormParam(), and TrainTargetAdapt().

void Oracle ( String &  idTar,
String &  idTest,
double &  score,
Config &  config,
MixtureGD &  tar,
MixtureGD &  non,
StatServer &  ss 
)

Definition at line 1404 of file UnsupervisedTools.cpp.

References line, and WMAPGMMFixedPriors().

Referenced by TrainTargetAdapt().

void resetWeights ( DoubleVector &  decision )

Definition at line 1390 of file UnsupervisedTools.cpp.

double searchLLRFromResFile ( String &  idTar,
String &  test,
String &  inputResFilename,
Config &  config 
)

Definition at line 1527 of file UnsupervisedTools.cpp.

References line.

Referenced by TrainTargetAdapt().

double SegClusterFrame ( SegCluster &  SegC )
String selectNearestTarModel ( String &  TARListFilename,
String &  fullFileName,
Config &  config,
StatServer &  ss,
FeatureServer &  fs,
MixtureGD &  world,
SegCluster &  selectedSegments,
MixtureServer &  ms 
)

Definition at line 1654 of file UnsupervisedTools.cpp.

References computeFastLLR(), computeLLR(), FileExists(), and line.

Referenced by TrainTargetAdapt().

void WMAP ( DoubleVector &  decision,
Config &  configTest 
)

Definition at line 901 of file UnsupervisedTools.cpp.

Referenced by TrainTargetAdapt().

void WMAPGMM ( DoubleVector &  decision,
Config &  configTest,
MixtureGD &  tar,
MixtureGD &  non,
StatServer &  ss 
)

Definition at line 1038 of file UnsupervisedTools.cpp.

References computePriors(), debug, verbose, and verboseLevel.

Referenced by TrainTargetAdapt().

void WMAPGMMFixedPriors ( DoubleVector &  decision,
Config &  configTest,
MixtureGD &  tar,
MixtureGD &  non,
StatServer &  ss 
)

Definition at line 985 of file UnsupervisedTools.cpp.

References debug, verbose, and verboseLevel.

Referenced by adaptModelEMweightedFrames(), Oracle(), and TrainTargetAdapt().