name: RelevanceVectorModel : public StatisticalModelBase
synopsis:

>     g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_stat.a

>     #include <RelevanceVectorModel.h>

>     long sofAccumulatorSize() const;
>     long sofOccupanciesSize() const;
>     boolean readAccumulator(Sof& sof, long tag, const String& cname = CLASS_NAME);
>     boolean writeAccumulator(Sof& sof, long tag, const String& cname = CLASS_NAME) const;
>     boolean readAccumulatorData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
>     boolean writeAccumulatorData(Sof& sof, const String& pname = DEF_PARAM) const;
>     boolean readOccupancies(Sof& sof, long tag, const String& cname = CLASS_NAME);
>     boolean writeOccupancies(Sof& sof, long tag, const String& cname = CLASS_NAME) const;
>     boolean readOccupanciesData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
>     boolean writeOccupanciesData(Sof& sof, const String& pname = DEF_PARAM) const;
>     boolean setAlgorithm(ALGORITHM algo);
>     ALGORITHM getAlgorithm();
>     boolean setImplementation(IMPLEMENTATION impl);
>     IMPLEMENTATION getImplemenation();
>     MatrixFloat& getInvHessian();
>     VectorFloat& getWeights();
>     VectorByte& getTargets();
>     Vector<VectorFloat>& getRelevanceVectors();
>     Float& getBias();
>     Kernel& getKernel(long index);
>     Vector<Kernel>& getKernels();
>     boolean setMode(MODE arg);
>     const String& className() const;
>     boolean init();
>     float getDistanceProb(const VectorFloat& input_a);
>     float getLikelihood(const VectorFloat& input);
>     float getLogLikelihood(const VectorFloat& input);
>     boolean getMean(VectorFloat& mean);
>     boolean getCovariance(MatrixFloat& cov);
>     boolean resetAccumulators();
>     double getOccupancy();
>     boolean setOccupancy(double arg);
>     long getAccessCount();
>     boolean setAccessCount(long arg);
>     boolean accumulate(VectorDouble& param, VectorFloat& data, boolean precomp);
>     boolean update(VectorFloat& varfloor, long min_count);
>     boolean accumulate(VectorFloat& data);
>     boolean initialize(VectorFloat& param);

quick start:

>     VectorFloat test_vector(L"0.1, 0.3");

>     RelevanceVectorModel rvm;
>     rvm.getLogLikelihood(test_vector);

description:
The RelevanceVectorModel class is used to compute the probability of a vector give the model, which specified by the relevance vector machine.
dependencies:

- Vector
- Kernel
- StatisticalModelBase
- MemoryManager

public constants:

- define enumeration types:

      enum ALGORITHM { SINGLE_KERNEL = 0, MULTIPLE_KERNEL, DEF_ALGORITHM = SINGLE_KERNEL };

      enum IMPLEMENTATION { LOGISTIC_SIGMOID_LINK = 0, DEF_IMPLEMENTATION =  LOGISTIC_SIGMOID_LINK };

- define name maps:

      static const NameMap ALGO_MAP;

      static const NameMap IMPL_MAP;

- define i/o constants:

      static const String CLASS_NAME;

      static const String DEF_PARAM;

      static const String PARAM_ALGORITHM;

      static const String PARAM_IMPLEMENTATION;

      static const String PARAM_BIAS;

      static const String PARAM_WEIGHTS;

      static const String PARAM_INV_HESSIAN;

      static const String PARAM_TARGETS;

      static const String PARAM_VECTORS;

      static const String PARAM_KERNELS;

      static const String DEF_COMMENT_TAG;

error codes:

- error codes indicating general errors:

protected data:

- define algorithm and implementation:

      ALGORITHM algorithm_d;

      IMPLEMENTATION implementation_d;

- relevance vector weights, vectors, and labels:

      MatrixDouble inv_hessian_d;

      VectorDouble weights_d;

      VectorByte targets_d;

      Vector<VectorDouble> vectors_d;

      Double bias_d;

- kernel function: we assume that the same kernel is used for all training points. this only makes sense though since anything else would mean different training points operating in different spaces.:

      Vector<Kernel> kernels_d;

- declare the memory manager:

      static MemoryManager mgr_d;

required public methods:

- static methods:

      static const String& name();

- debug methods:

      static boolean diagnose(Integral::DEBUG debug_level);

      boolean debug(const unichar* msg) const;

- destructor/constructor(s):

      ~RelevanceVectorModel();

      RelevanceVectorModel();

      RelevanceVectorModel(const RelevanceVectorModel& arg);

- assign methods:

      boolean assign(const RelevanceVectorModel& arg);

      boolean assign(const StatisticalModelBase& arg);

- operator= method:

      RelevanceVectorModel& operator=(const RelevanceVectorModel& arg);

- i/o methods:

      long sofSize() const;

      boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);

      boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;

      boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);

      boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;

- equality methods:

      boolean eq(const RelevanceVectorModel& arg) const;

      boolean eq(const StatisticalModelBase& arg) const;

- memory management methods:

      static void* operator new(size_t size);

      static void* operator new[](size_t size);

      static void operator delete(void* ptr);

      static void operator delete[](void* ptr);

      static boolean setGrowSize(long grow_size);

      boolean clear(Integral::CMODE cmode = Integral::DEF_CMODE);

class-specific public methods:

- declare class specific methods:

      long sofAccumulatorSize() const;

      long sofOccupanciesSize() const;

      boolean readAccumulator(Sof& sof, long tag, const String& cname = CLASS_NAME);

      boolean writeAccumulator(Sof& sof, long tag, const String& cname = CLASS_NAME) const;

      boolean readAccumulatorData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);

      boolean writeAccumulatorData(Sof& sof, const String& pname = DEF_PARAM) const;

      boolean readOccupancies(Sof& sof, long tag, const String& cname = CLASS_NAME);

      boolean writeOccupancies(Sof& sof, long tag, const String& cname = CLASS_NAME) const;

      boolean readOccupanciesData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);

      boolean writeOccupanciesData(Sof& sof, const String& pname = DEF_PARAM) const;

      boolean setAlgorithm(ALGORITHM algo);

      ALGORITHM getAlgorithm();

      boolean setImplementation(IMPLEMENTATION impl);

      IMPLEMENTATION getImplemenation();

      MatrixDouble& getInvHessian();

      VectorDouble& getWeights();

      VectorByte& getTargets();

      Vector<VectorDouble>& getRelevanceVectors();

      Double& getBias();

      Kernel& getKernel(long index);

      Vector<Kernel>& getKernels();

      const String& className() const;

- declare base class interface contract methods:

      boolean setMode(MODE arg);

      boolean init();

      float getLikelihood(const VectorFloat& input);

      float getDistanceProb(const VectorFloat& input);

      float getLogLikelihood(const VectorFloat& input);

      boolean getMean(VectorFloat& mean);

      boolean getCovariance(MatrixFloat& cov);

      boolean resetAccumulators();

      double getOccupancy();

      boolean setOccupancy(double arg);

      long getAccessCount();

      boolean setAccessCount(long arg);

      boolean accumulate(VectorDouble& param, VectorFloat& data, boolean precomp);

      boolean update(VectorFloat& varfloor, long min_count);

      boolean accumulate(VectorFloat& data);

      boolean initialize(VectorFloat& param);

private methods:

- none.

examples:

- none.

notes:

- none.