SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
QuadraticTimeMMD.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) 2012-2013 Heiko Strathmann
00008  */
00009 
00010 #ifndef __QUADRACTIMEMMD_H_
00011 #define __QUADRACTIMEMMD_H_
00012 
00013 #include <shogun/statistics/KernelTwoSampleTestStatistic.h>
00014 
00015 namespace shogun
00016 {
00017 
00018 class CFeatures;
00019 class CKernel;
00020 class CCustomKernel;
00021 
00023 enum EQuadraticMMDType
00024 {
00025     BIASED, UNBIASED
00026 };
00027 
00086 class CQuadraticTimeMMD : public CKernelTwoSampleTestStatistic
00087 {
00088     public:
00089         CQuadraticTimeMMD();
00090 
00101         CQuadraticTimeMMD(CKernel* kernel, CFeatures* p_and_q, index_t m);
00102 
00114         CQuadraticTimeMMD(CKernel* kernel, CFeatures* p, CFeatures* q);
00115 
00125         CQuadraticTimeMMD(CCustomKernel* custom_kernel, index_t m);
00126 
00127         virtual ~CQuadraticTimeMMD();
00128 
00135         virtual float64_t compute_statistic();
00136 
00144         virtual SGVector<float64_t> compute_statistic(bool multiple_kernels);
00145 
00157         virtual float64_t compute_p_value(float64_t statistic);
00158 
00169         virtual float64_t compute_threshold(float64_t alpha);
00170 
00171         virtual const char* get_name() const
00172         {
00173             return "QuadraticTimeMMD";
00174         };
00175 
00177         virtual EStatisticType get_statistic_type() const
00178         {
00179             return S_QUADRATIC_TIME_MMD;
00180         }
00181 
00182 #ifdef HAVE_LAPACK
00183 
00205         SGVector<float64_t> sample_null_spectrum(index_t num_samples,
00206                 index_t num_eigenvalues);
00207 #endif // HAVE_LAPACK
00208 
00215         void set_num_samples_sepctrum(index_t num_samples_spectrum);
00216 
00223         void set_num_eigenvalues_spectrum(index_t num_eigenvalues_spectrum);
00224 
00226         void set_statistic_type(EQuadraticMMDType statistic_type);
00227 
00248         SGVector<float64_t> fit_null_gamma();
00249 
00250     protected:
00252         virtual float64_t compute_unbiased_statistic();
00253 
00255         virtual float64_t compute_biased_statistic();
00256 
00257     private:
00258         void init();
00259 
00260     protected:
00262         index_t m_num_samples_spectrum;
00263 
00265         index_t m_num_eigenvalues_spectrum;
00266 
00268         EQuadraticMMDType m_statistic_type;
00269 };
00270 
00271 }
00272 
00273 #endif /* __QUADRACTIMEMMD_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation