SHOGUN  3.2.1
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
Statistics.h
浏览该文件的文档.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2011-2012 Heiko Strathmann
8  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9  *
10  * ALGLIB Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier under GPL2+
11  * http://www.alglib.net/
12  * See method comments which functions are taken from ALGLIB (with adjustments
13  * for shogun)
14  */
15 
16 #ifndef __STATISTICS_H_
17 #define __STATISTICS_H_
18 
19 #include <math.h>
20 #include <shogun/lib/config.h>
21 #include <shogun/base/SGObject.h>
22 
23 namespace shogun
24 {
25 template<class T> class SGMatrix;
26 template<class T> class SGSparseMatrix;
27 
31 class CStatistics: public CSGObject
32 {
33 
34 public:
35 
42  static float64_t mean(SGVector<float64_t> values);
43 
70  static float64_t median(SGVector<float64_t> values, bool modify=false,
71  bool in_place=false);
72 
91  bool modify=false, bool in_place=false);
92 
101  static float64_t variance(SGVector<float64_t> values);
102 
112 
124  bool col_wise=true);
125 
139  bool col_wise=true);
140 
154  SGMatrix<float64_t> values, bool col_wise=true);
155 
156 #ifdef HAVE_LAPACK
157 
175  SGMatrix<float64_t> observations, bool in_place=false);
176 #endif //HAVE_LAPACK
177 
193  float64_t alpha, float64_t& conf_int_low, float64_t& conf_int_up);
194 
202  static float64_t inverse_student_t(int32_t k, float64_t p);
203 
216  float64_t y);
217 
241 
259 
262  float64_t std_dev);
263 
265  static inline float64_t lgamma(float64_t x)
266  {
267  return ::lgamma((double) x);
268  }
269 
272  static inline floatmax_t lgammal(floatmax_t x)
273  {
274 #ifdef HAVE_LGAMMAL
275  return ::lgammal((long double) x);
276 #else
277  return ::lgamma((double) x);
278 #endif // HAVE_LGAMMAL
279  }
280 
282  static inline float64_t tgamma(float64_t x)
283  {
284  return ::tgamma((double) x);
285  }
286 
304 
322 
332 
343 
359  float64_t y0);
360 
378  static float64_t normal_cdf(float64_t x, float64_t std_dev=1);
379 
395  static float64_t lnormal_cdf(float64_t x);
396 
413 
429 
432  static float64_t mutual_info(float64_t* p1, float64_t* p2, int32_t len);
433 
437  float64_t* p, float64_t* q, int32_t len);
438 
440  static float64_t entropy(float64_t* p, int32_t len);
441 
446 
451 
456  static SGVector<int32_t> sample_indices(int32_t sample_size, int32_t N);
457 
459  virtual const char* get_name() const
460  {
461  return "Statistics";
462  }
463 
469  static float64_t dlgamma(float64_t x);
470 
473  {
476 
479  };
480 
495 
496 #ifdef HAVE_EIGEN3
497 
512 
529 
546  SGMatrix<float64_t> cov, int32_t N=1, bool precision_matrix=false);
547 
564  SGSparseMatrix<float64_t> cov, int32_t N=1, bool precision_matrix=false);
565 #endif //HAVE_EIGEN3
566 
567 
568 protected:
575  float64_t x, float64_t maxgam);
576 
582  float64_t x, float64_t big, float64_t biginv);
583 
589  float64_t x, float64_t big, float64_t biginv);
590 
592  static inline bool equal(float64_t a, float64_t b) { return a==b; }
593 
595  static inline bool not_equal(float64_t a, float64_t b) { return a!=b; }
596 
598  static inline bool less(float64_t a, float64_t b) { return a<b; }
599 
601  static inline bool less_equal(float64_t a, float64_t b) { return a<=b; }
602 
604  static inline bool greater(float64_t a, float64_t b) { return a>b; }
605 
607  static inline bool greater_equal(float64_t a, float64_t b) { return a>=b; }
608 };
609 
610 }
611 
612 #endif /* __STATISTICS_H_ */
static SGVector< int32_t > sample_indices(int32_t sample_size, int32_t N)
static SGVector< float64_t > matrix_mean(SGMatrix< float64_t > values, bool col_wise=true)
Definition: Statistics.cpp:224
template class SGSparseMatrix
static bool less_equal(float64_t a, float64_t b)
Definition: Statistics.h:601
static bool not_equal(float64_t a, float64_t b)
Definition: Statistics.h:595
static float64_t error_function(float64_t x)
static float64_t ibetaf_incompletebetafe(float64_t a, float64_t b, float64_t x, float64_t big, float64_t biginv)
static SGVector< float64_t > matrix_std_deviation(SGMatrix< float64_t > values, bool col_wise=true)
Definition: Statistics.cpp:306
static float64_t lgamma(float64_t x)
Definition: Statistics.h:265
static bool greater_equal(float64_t a, float64_t b)
Definition: Statistics.h:607
static float64_t incomplete_gamma_completed(float64_t a, float64_t x)
static float64_t inverse_normal_cdf(float64_t y0)
static float64_t std_deviation(SGVector< float64_t > values)
Definition: Statistics.cpp:301
static float64_t confidence_intervals_mean(SGVector< float64_t > values, float64_t alpha, float64_t &conf_int_low, float64_t &conf_int_up)
Definition: Statistics.cpp:341
static SGVector< float64_t > fishers_exact_test_for_multiple_2x3_tables(SGMatrix< float64_t > tables)
static float64_t relative_entropy(float64_t *p, float64_t *q, int32_t len)
static SGMatrix< float64_t > sample_from_gaussian(SGVector< float64_t > mean, SGMatrix< float64_t > cov, int32_t N=1, bool precision_matrix=false)
static float64_t median(SGVector< float64_t > values, bool modify=false, bool in_place=false)
Definition: Statistics.cpp:46
static float64_t ibetaf_incompletebetaps(float64_t a, float64_t b, float64_t x, float64_t maxgam)
static float64_t mutual_info(float64_t *p1, float64_t *p2, int32_t len)
static float64_t gamma_cdf(float64_t x, float64_t a, float64_t b)
static float64_t log_det(SGMatrix< float64_t > m)
Class that contains certain functions related to statistics, such as probability/cumulative distribut...
Definition: Statistics.h:31
static float64_t lnormal_cdf(float64_t x)
static float64_t tgamma(float64_t x)
Definition: Statistics.h:282
static SigmoidParamters fit_sigmoid(SGVector< float64_t > scores)
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:102
static float64_t inverse_incomplete_beta(float64_t a, float64_t b, float64_t y)
Definition: Statistics.cpp:416
static float64_t entropy(float64_t *p, int32_t len)
double float64_t
Definition: common.h:48
static float64_t matrix_median(SGMatrix< float64_t > values, bool modify=false, bool in_place=false)
Definition: Statistics.cpp:198
long double floatmax_t
Definition: common.h:49
virtual const char * get_name() const
Definition: Statistics.h:459
static float64_t inverse_student_t(int32_t k, float64_t p)
Definition: Statistics.cpp:368
static float64_t ibetaf_incompletebetafe2(float64_t a, float64_t b, float64_t x, float64_t big, float64_t biginv)
static SGMatrix< float64_t > covariance_matrix(SGMatrix< float64_t > observations, bool in_place=false)
Definition: Statistics.cpp:317
static bool less(float64_t a, float64_t b)
Definition: Statistics.h:598
static float64_t error_function_complement(float64_t x)
static float64_t dlgamma(float64_t x)
static float64_t variance(SGVector< float64_t > values)
Definition: Statistics.cpp:210
static float64_t normal_cdf(float64_t x, float64_t std_dev=1)
static float64_t inverse_gamma_cdf(float64_t p, float64_t a, float64_t b)
static float64_t incomplete_beta(float64_t a, float64_t b, float64_t x)
Definition: Statistics.cpp:868
static float64_t mean(SGVector< float64_t > values)
Definition: Statistics.cpp:34
static bool greater(float64_t a, float64_t b)
Definition: Statistics.h:604
static float64_t fishers_exact_test_for_2x3_table(SGMatrix< float64_t > table)
static SGVector< float64_t > matrix_variance(SGMatrix< float64_t > values, bool col_wise=true)
Definition: Statistics.cpp:261
static bool equal(float64_t a, float64_t b)
Definition: Statistics.h:592
static float64_t incomplete_gamma(float64_t a, float64_t x)
static floatmax_t lgammal(floatmax_t x)
Definition: Statistics.h:272
static float64_t inverse_incomplete_gamma_completed(float64_t a, float64_t y0)

SHOGUN 机器学习工具包 - 项目文档