SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
LinearTimeMMD.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 __LINEARTIMEMMD_H_
00011 #define __LINEARTIMEMMD_H_
00012 
00013 #include <shogun/statistics/KernelTwoSampleTestStatistic.h>
00014 #include <shogun/kernel/Kernel.h>
00015 #include <shogun/lib/external/libqp.h>
00016 
00017 namespace shogun
00018 {
00019 
00020 class CStreamingFeatures;
00021 class CFeatures;
00022 
00075 class CLinearTimeMMD: public CKernelTwoSampleTestStatistic
00076 {
00077 public:
00078     CLinearTimeMMD();
00079 
00090     CLinearTimeMMD(CKernel* kernel, CStreamingFeatures* p,
00091             CStreamingFeatures* q, index_t m, index_t blocksize=10000);
00092 
00093     virtual ~CLinearTimeMMD();
00094 
00103     virtual float64_t compute_statistic();
00104 
00112     virtual SGVector<float64_t> compute_statistic(bool multiple_kernels);
00113 
00127     virtual float64_t compute_p_value(float64_t statistic);
00128 
00144     virtual float64_t perform_test();
00145 
00158     virtual float64_t compute_threshold(float64_t alpha);
00159 
00167     virtual float64_t compute_variance_estimate();
00168 
00187     virtual void compute_statistic_and_variance(
00188             SGVector<float64_t>& statistic, SGVector<float64_t>& variance,
00189             bool multiple_kernels=false);
00190 
00195     virtual void compute_statistic_and_Q(
00196             SGVector<float64_t>& statistic, SGMatrix<float64_t>& Q);
00197 
00207     virtual SGVector<float64_t> bootstrap_null();
00208 
00212     void set_blocksize(index_t blocksize) { m_blocksize=blocksize; }
00213 
00215     virtual void set_p_and_q(CFeatures* p_and_q);
00216 
00218     virtual CFeatures* get_p_and_q();
00219 
00223     virtual CStreamingFeatures* get_streaming_p();
00224 
00228     virtual CStreamingFeatures* get_streaming_q();
00229 
00231     virtual EStatisticType get_statistic_type() const
00232     {
00233         return S_LINEAR_TIME_MMD;
00234     }
00235 
00239     inline void set_simulate_h0(bool simulate_h0) { m_simulate_h0=simulate_h0; }
00240 
00241 
00242     virtual const char* get_name() const
00243     {
00244         return "LinearTimeMMD";
00245     }
00246 
00247 private:
00248     void init();
00249 
00250 protected:
00252     CStreamingFeatures* m_streaming_p;
00253 
00255     CStreamingFeatures* m_streaming_q;
00256 
00258     index_t m_blocksize;
00259 
00262     bool m_simulate_h0;
00263 };
00264 
00265 }
00266 
00267 #endif /* __LINEARTIMEMMD_H_ */
00268 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation