MindyGramKernel.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "lib/config.h"
00012
00013 #ifdef HAVE_MINDY
00014
00015 #include <mindy.h>
00016
00017 #ifndef _MINDYGRAMKERNEL_H___
00018 #define _MINDYGRAMKERNEL_H___
00019
00020 #include "lib/common.h"
00021 #include "kernel/Kernel.h"
00022
00023
00024 #define NO_SICO -1
00025
00026
00027 typedef struct {
00028 char *name;
00029 int32_t idx;
00030 float64_t val;
00031 char *descr;
00032 } param_spec_t;
00033
00034 class CMindyGramKernel: public CKernel
00035 {
00036 public:
00037
00038 CMindyGramKernel(int32_t ch, char *measure, float64_t width);
00039 CMindyGramKernel(
00040 CFeatures *l, CFeatures *r, char *measure, float64_t width);
00041 virtual ~CMindyGramKernel();
00042
00043
00044 void set_param(char *param);
00045
00046 void set_md5cache(int32_t c);
00047
00048 void set_norm(ENormalizationType e);
00049
00050
00051 void parse_params(char *);
00052 virtual bool init(CFeatures* l, CFeatures* r);
00053 virtual void cleanup();
00054 virtual void remove_lhs();
00055 virtual void remove_rhs();
00056
00057
00058 inline virtual EKernelType get_kernel_type() { return K_MINDYGRAM; }
00059 inline virtual EFeatureType get_feature_type() { return F_ULONG; }
00060 inline virtual EFeatureClass get_feature_class() { return C_MINDYGRAM; }
00061 inline virtual const char* get_name() const { return "MindyGram"; }
00062
00063
00064 virtual bool init_optimization(
00065 int32_t count, int32_t *IDX, float64_t * weights);
00066 virtual bool delete_optimization();
00067 virtual float64_t compute_optimized(int32_t idx);
00068 virtual void add_to_normal(int32_t idx, float64_t weight);
00069 virtual void clear_normal();
00070
00071
00072 bool load_init(FILE* src);
00073 bool save_init(FILE* dest);
00074
00075 protected:
00076
00077 float64_t compute(int32_t idx_a, int32_t idx_b);
00078
00079 private:
00080
00081 char *measure;
00082
00083 sico_t simcof;
00084
00085 ENormalizationType norm;
00086
00087 sm_t *kernel;
00088
00089 gram_t *normal;
00090
00091 size_t cache;
00092
00093 float64_t width;
00094
00095 };
00096 #endif
00097 #endif