SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ProbingSampler.h
Go to the documentation of this file.
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) 2013 Soumyajit De
8  */
9 
10 #ifndef PROBING_SAMPLER_H_
11 #define PROBING_SAMPLER_H_
12 
13 #include <shogun/lib/config.h>
14 
15 #ifdef HAVE_COLPACK
16 
18 
19 namespace shogun
20 {
21 
23 enum EOrderingVariant
24 {
25  NATURAL=0,
26  LARGEST_FIRST,
27  DYNAMIC_LARGEST_FIRST,
28  DISTANCE_TWO_LARGEST_FIRST,
29  SMALLEST_LAST,
30  DISTANCE_TWO_SMALLEST_LAST,
31  INCIDENCE_DEGREE,
32  DISTANCE_TWO_INCIDENCE_DEGREE,
33  RANDOM
34 };
35 
37 enum EColoringVariant
38 {
39  DISTANCE_ONE=0,
40  ACYCLIC,
41  ACYCLIC_FOR_INDIRECT_RECOVERY,
42  STAR,
43  RESTRICTED_STAR,
44  DISTANCE_TWO
45 };
46 
47 template<class T> class SGVector;
48 template<class T> class SGString;
49 template<class T> class CSparseMatrixOperator;
50 
55 class CProbingSampler : public CTraceSampler
56 {
57 public:
59  CProbingSampler();
60 
70  CProbingSampler(CSparseMatrixOperator<float64_t>* matrix_operator,
71  int64_t power=1, EOrderingVariant ordering=NATURAL,
72  EColoringVariant coloring=DISTANCE_TWO);
73 
75  virtual ~CProbingSampler();
76 
81  void set_coloring_vector(SGVector<int32_t> coloring_vector);
82 
84  SGVector<int32_t> get_coloring_vector() const;
85 
92  virtual SGVector<float64_t> sample(index_t idx) const;
93 
95  virtual void precompute();
96 
98  virtual const char* get_name() const
99  {
100  return "ProbingSampler";
101  }
102 
103 private:
105  CSparseMatrixOperator<float64_t>* m_matrix_operator;
106 
108  int64_t m_power;
109 
111  SGVector<int32_t> m_coloring_vector;
112 
114  EOrderingVariant m_ordering;
115 
117  EColoringVariant m_coloring;
118 
120  bool m_is_precomputed;
121 
123  void init();
124 
125 };
126 
127 }
128 
129 #endif // HAVE_COLPACK
130 #endif // PROBING_SAMPLER_H_
int32_t index_t
Definition: common.h:62
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18

SHOGUN Machine Learning Toolbox - Documentation