SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
IndexFeatures.cpp
Go to the documentation of this file.
3 
4 using namespace shogun;
5 
7 {
8  init();
9 }
10 
12 {
13  init();
14  set_feature_index(feature_index);
15 }
16 
18 {
19 }
20 
22 {
24 }
25 
27 {
28  CIndexFeatures* indexfeature_dup =
30  if (m_subset_stack != NULL)
31  {
32  SG_UNREF(indexfeature_dup->m_subset_stack);
33  indexfeature_dup->m_subset_stack=new CSubsetStack(*m_subset_stack);
34  SG_REF(indexfeature_dup->m_subset_stack);
35  }
36  return indexfeature_dup;
37 }
38 
40 {
41  return F_ANY;
42 }
43 
45 {
46  return C_INDEX;
47 }
48 
50 {
52  return m_feature_index;
53 
54  SGVector<index_t> sub_feature_index(get_num_vectors());
55 
56  /* copy a subset vector wise */
57  for (int32_t i=0; i<sub_feature_index.vlen; ++i)
58  {
59  int32_t real_i = m_subset_stack->subset_idx_conversion(i);
60  sub_feature_index[i] = m_feature_index[real_i];
61  }
62 
63  return sub_feature_index;
64 }
65 
67 {
70  m_feature_index = feature_index;
71  num_vectors = feature_index.vlen;
72 }
73 
75 {
78  num_vectors = 0;
79 }
80 
81 void CIndexFeatures::init()
82 {
83  num_vectors = 0;
84  SG_ADD(&m_feature_index, "m_feature_index",
85  "Vector of feature index.", MS_NOT_AVAILABLE);
86 }
CSubsetStack * m_subset_stack
Definition: Features.h:361
void set_feature_index(SGVector< index_t > feature_index)
virtual EFeatureType get_feature_type() const
virtual EFeatureClass get_feature_class() const
virtual int32_t get_num_vectors() const
index_t get_size() const
Definition: SubsetStack.h:80
The class IndexFeatures implements features that contain the index of the features. This features used in the CCustomKernel::init to make the subset of the kernel matrix. Initial CIndexFeature of row_idx and col_idx, pass them to the CCustomKernel::init(row_idx, col_idx), then use CCustomKernel::get_kernel_matrix() will get the sub kernel matrix specified by the row_idx and col_idx.
Definition: IndexFeatures.h:53
virtual CFeatures * duplicate() const
SGVector< index_t > m_feature_index
#define SG_REF(x)
Definition: SGObject.h:54
EFeatureClass
shogun feature class
Definition: FeatureTypes.h:38
class to add subset support to another class. A CSubsetStackStack instance should be added and wrappe...
Definition: SubsetStack.h:37
SGVector< index_t > get_feature_index()
index_t vlen
Definition: SGVector.h:494
virtual void remove_all_subsets()
Definition: SubsetStack.cpp:59
index_t subset_idx_conversion(index_t idx) const
Definition: SubsetStack.h:105
EFeatureType
shogun feature type
Definition: FeatureTypes.h:19
#define SG_UNREF(x)
Definition: SGObject.h:55
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
The class Features is the base class of all feature objects.
Definition: Features.h:68
SGVector< T > clone() const
Definition: SGVector.cpp:207
virtual bool has_subsets() const
Definition: SubsetStack.h:89
#define SG_ADD(...)
Definition: SGObject.h:84

SHOGUN Machine Learning Toolbox - Documentation