📄 statisticalmodelbase.h
字号:
// file: $isip/class/stat/StatisticalModel/StatisticalModelBase.h// version: $Id: StatisticalModelBase.h,v 1.21 2002/10/18 21:47:01 alphonso Exp $//// make sure definitions are only made once//#ifndef ISIP_STATISTICAL_MODEL_BASE#define ISIP_STATISTICAL_MODEL_BASE// isip include files//#ifndef ISIP_NAME_MAP#include <NameMap.h>#endif#ifndef ISIP_STRING#include <String.h>#endif// forward class definitions//class VectorFloat;class VectorDouble;class MatrixFloat;// StatisticalModelBase: defines the minimal interface contract for all// classes in the stat library//class StatisticalModelBase { //--------------------------------------------------------------------------- // // public constants // //---------------------------------------------------------------------------public: // define the class name // static const String CLASS_NAME; //----------------------------------------- // // other important constants // //----------------------------------------- // define the compute mode // enum MODE { NONE = 0, PRECOMPUTE, DEF_MODE = PRECOMPUTE }; // a static name map // static const NameMap MODE_MAP; //---------------------------------------- // // default values and arguments // //---------------------------------------- // define the default value(s) of the class data // //---------------------------------------- // // error codes // //---------------------------------------- static const long ERR = 60301; //--------------------------------------------------------------------------- // // protected data // //---------------------------------------------------------------------------protected: // computation mode that determines whether we will optimize computations // for run-time or recompute intermediate results on every call to the // likelihood functions // MODE mode_d; boolean is_valid_d; // debugging parameters // static Integral::DEBUG debug_level_d; //--------------------------------------------------------------------------- // // required public methods // //---------------------------------------------------------------------------public: // method: name // static const String& name() { return CLASS_NAME; } // debug methods // virtual boolean debug(const unichar* msg) const = 0; // method: setDebug // static boolean setDebug(Integral::DEBUG debug_level) { debug_level_d = debug_level; return true; } // destructor/constructor(s) // virtual ~StatisticalModelBase() {} // method: default constructor // StatisticalModelBase(MODE mode = DEF_MODE) { mode_d = mode; is_valid_d = false; } // assign methods // virtual boolean assign(const StatisticalModelBase& arg) = 0; // equality methods // virtual boolean eq(const StatisticalModelBase& arg) const = 0; // i/o methods // virtual long sofSize() const = 0; virtual long sofAccumulatorSize() const = 0; virtual long sofOccupanciesSize() const = 0; virtual boolean read(Sof& sof, long tag, const String& name) = 0; virtual boolean write(Sof& sof, long tag, const String& name) const = 0; virtual boolean readData(Sof& sof, const String& pname, long size, boolean param, boolean nested) = 0; virtual boolean writeData(Sof& sof, const String& pname) const = 0; virtual boolean readAccumulator(Sof& sof, long tag, const String& name) = 0; virtual boolean writeAccumulator(Sof& sof, long tag, const String& name) const = 0; virtual boolean readAccumulatorData(Sof& sof, const String& pname, long size, boolean param, boolean nested) = 0; virtual boolean writeAccumulatorData(Sof& sof, const String& pname) const = 0; virtual boolean readOccupancies(Sof& sof, long tag, const String& name) = 0; virtual boolean writeOccupancies(Sof& sof, long tag, const String& name) const = 0; virtual boolean readOccupanciesData(Sof& sof, const String& pname, long size, boolean param, boolean nested) = 0; virtual boolean writeOccupanciesData(Sof& sof, const String& pname) const = 0; // other memory managements methods // virtual boolean clear(Integral::CMODE cmode = Integral::DEF_CMODE) = 0; //--------------------------------------------------------------------------- // // class-specific public methods: // these methods define the interface contract. note that the required // methods eq and assign, defined above, are also part of the interface. // //--------------------------------------------------------------------------- // identification methods // virtual const String& className() const = 0; // identification methods // virtual boolean init() = 0; // method: setMode // virtual boolean setMode(MODE mode) { mode_d = mode; return true; } // method: getMode // MODE getMode() const { return mode_d; } // method: getMean // virtual boolean getMean(VectorFloat& mean) = 0; // method: getCovariance // virtual boolean getCovariance(MatrixFloat& cov) = 0; // computational methods // virtual float getLikelihood(const VectorFloat& input) = 0; virtual float getLogLikelihood(const VectorFloat& input) = 0; // initialization methods // virtual boolean initialize(VectorFloat& param) = 0; virtual boolean accumulate(VectorFloat& data) = 0; // training methods // virtual boolean resetAccumulators() = 0; virtual double getOccupancy() = 0; virtual boolean setOccupancy(double arg) = 0; virtual long getAccessCount() = 0; virtual boolean setAccessCount(long arg) = 0; virtual boolean accumulate(VectorDouble& param, VectorFloat& data, boolean precomp) = 0; virtual boolean update(VectorFloat& varfloor, long min_count) = 0; //--------------------------------------------------------------------------- // // private methods // //---------------------------------------------------------------------------private: };// end of include file// #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -