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<DREAL>
00023 {
00024 public:
00025 
00036     CPyramidChi2(INT size, DREAL width2,
00037         INT* pyramidlevels2, INT numlevels2,
00038         INT  numbinsinhistogram2, DREAL* weights2, INT numweights2);
00039 
00052     CPyramidChi2(CRealFeatures* l, CRealFeatures* r, INT size, DREAL width2,
00053         INT* pyramidlevels2, INT numlevels2,
00054         INT  numbinsinhistogram2, DREAL* weights2, INT numweights2);
00055 
00061     virtual bool init(CFeatures* l, CFeatures* r);
00062 
00063 
00064     virtual ~CPyramidChi2();
00065 
00067     virtual void cleanup();
00068 
00069     /* load kernel init_data
00070      *
00071      * @param src source file to load from
00072      * @return if loading was successful
00073      */
00074     virtual bool load_init(FILE* src);
00075 
00081     virtual bool save_init(FILE* dest);
00082 
00084     virtual EKernelType get_kernel_type()
00085     {
00086         //preliminary output
00087         return K_PYRAMIDCHI2;
00088     }
00089 
00091     virtual const CHAR* get_name()
00092     {
00093         return("PyramidoverChi2\0");
00094     }
00095 
00097     void setstandardweights();
00098 
00100     bool sanitycheck_weak();
00101 
00102 protected:
00109     virtual DREAL compute(INT idx_a, INT idx_b);
00110 
00111 protected:
00113     DREAL width;
00115     INT* pyramidlevels;
00116 
00118     INT numlevels;
00120     INT numbinsinhistogram;
00122     DREAL* weights;
00123 
00125     INT numweights;
00126     //bool sanitycheckbit;
00127 };
00128 
00129 #endif /*PYRAMIDCHI2_H_*/

SHOGUN Machine Learning Toolbox - Documentation