PyramidChi2.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 2008 Alexander Binder
00008  * Copyright (C) 2008 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef PYRAMIDCHI2_H_
00012 #define PYRAMIDCHI2_H_
00013 
00014 #include "lib/common.h"
00015 #include "kernel/SimpleKernel.h"
00016 #include "features/Features.h"
00017 #include "features/RealFeatures.h"
00018 
00019 //TODO: port to CCombinedKernel (if it is the appropriate) as the pyramid is a weighted linear combination of kernels
00020 
00022 class CPyramidChi2 : public CSimpleKernel<float64_t>
00023 {
00024 public:
00025 
00036     CPyramidChi2(
00037         int32_t size, float64_t width2,
00038         int32_t* pyramidlevels2, int32_t numlevels2,
00039         int32_t  numbinsinhistogram2, float64_t* weights2, int32_t numweights2);
00040 
00053     CPyramidChi2(
00054         CRealFeatures* l, CRealFeatures* r, int32_t size, float64_t width2,
00055         int32_t* pyramidlevels2, int32_t numlevels2,
00056         int32_t  numbinsinhistogram2, float64_t* weights2, int32_t numweights2);
00057 
00063     virtual bool init(CFeatures* l, CFeatures* r);
00064 
00065 
00066     virtual ~CPyramidChi2();
00067 
00069     virtual void cleanup();
00070 
00071     /* load kernel init_data
00072      *
00073      * @param src source file to load from
00074      * @return if loading was successful
00075      */
00076     virtual bool load_init(FILE* src);
00077 
00083     virtual bool save_init(FILE* dest);
00084 
00086     virtual EKernelType get_kernel_type()
00087     {
00088         //preliminary output
00089         return K_PYRAMIDCHI2;
00090     }
00091 
00093     virtual const char* get_name() { return "PyramidoverChi2"; }
00094 
00096     void setstandardweights();
00097 
00099     bool sanitycheck_weak();
00100 
00101 protected:
00108     virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00109 
00110 protected:
00112     float64_t width;
00114     int32_t* pyramidlevels;
00115 
00117     int32_t numlevels;
00119     int32_t numbinsinhistogram;
00121     float64_t* weights;
00122 
00124     int32_t numweights;
00125     //bool sanitycheckbit;
00126 };
00127 
00128 #endif /*PYRAMIDCHI2_H_*/

SHOGUN Machine Learning Toolbox - Documentation