// file: $isip/class/stat/StatisticalModel/StatisticalModelBase.h // version: $Id: StatisticalModelBase.h 8756 2002-10-18 21:47:07Z alphonso $ // // 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 #endif #ifndef ISIP_STRING #include #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 int32 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; bool8 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 bool8 debug(const unichar* msg) const = 0; // method: setDebug // static bool8 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 bool8 assign(const StatisticalModelBase& arg) = 0; // equality methods // virtual bool8 eq(const StatisticalModelBase& arg) const = 0; // i/o methods // virtual int32 sofSize() const = 0; virtual int32 sofAccumulatorSize() const = 0; virtual int32 sofOccupanciesSize() const = 0; virtual bool8 read(Sof& sof, int32 tag, const String& name) = 0; virtual bool8 write(Sof& sof, int32 tag, const String& name) const = 0; virtual bool8 readData(Sof& sof, const String& pname, int32 size, bool8 param, bool8 nested) = 0; virtual bool8 writeData(Sof& sof, const String& pname) const = 0; virtual bool8 readAccumulator(Sof& sof, int32 tag, const String& name) = 0; virtual bool8 writeAccumulator(Sof& sof, int32 tag, const String& name) const = 0; virtual bool8 readAccumulatorData(Sof& sof, const String& pname, int32 size, bool8 param, bool8 nested) = 0; virtual bool8 writeAccumulatorData(Sof& sof, const String& pname) const = 0; virtual bool8 readOccupancies(Sof& sof, int32 tag, const String& name) = 0; virtual bool8 writeOccupancies(Sof& sof, int32 tag, const String& name) const = 0; virtual bool8 readOccupanciesData(Sof& sof, const String& pname, int32 size, bool8 param, bool8 nested) = 0; virtual bool8 writeOccupanciesData(Sof& sof, const String& pname) const = 0; // other memory managements methods // virtual bool8 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 bool8 init() = 0; // method: setMode // virtual bool8 setMode(MODE mode) { mode_d = mode; return true; } // method: getMode // MODE getMode() const { return mode_d; } // method: getMean // virtual bool8 getMean(VectorFloat& mean) = 0; // method: getCovariance // virtual bool8 getCovariance(MatrixFloat& cov) = 0; // computational methods // virtual float32 getLikelihood(const VectorFloat& input) = 0; virtual float32 getLogLikelihood(const VectorFloat& input) = 0; // initialization methods // virtual bool8 initialize(VectorFloat& param) = 0; virtual bool8 accumulate(VectorFloat& data) = 0; // training methods // virtual bool8 resetAccumulators() = 0; virtual float64 getOccupancy() = 0; virtual bool8 setOccupancy(float64 arg) = 0; virtual int32 getAccessCount() = 0; virtual bool8 setAccessCount(int32 arg) = 0; virtual bool8 accumulate(VectorDouble& param, VectorFloat& data, bool8 precomp) = 0; virtual bool8 update(VectorFloat& varfloor, int32 min_count) = 0; //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: }; // end of include file // #endif