46 void CDependenceMaximization::init()
63 bool CDependenceMaximization::init(
CFeatures* features)
65 REQUIRE(features,
"Features are not initialized!\n");
68 "Only allowed for dense/sparse features! Provided an instance of "
69 "%s which is of class %d!\n",
72 "features of double type! Provided %d!\n",
86 REQUIRE(num_features>idx,
"Specified dimension to remove (%d) is greater "
87 "than the total number of current features (%d)!\n",
92 for (
index_t i=0; i<num_features; ++i)
122 SG_DEBUG(
"statistic = %f!\n", statistic);
136 "not set! Please use set_num_remove() to set this!\n");
138 "Only N_LARGEST and PERCENTILE_LARGEST removal policy can work "
140 REQUIRE(features,
"Features is not intialized!\n");
141 REQUIRE(argsorted.
vector,
"The argsorted vector is not initialized!\n");
143 "argsorted vector should be equal to the number of features (%d)! "
144 "But it was %d!\n", argsorted.
vlen);
149 threshold*=argsorted.
vlen*0.01;
152 REQUIRE(threshold<argsorted.
vlen,
"The threshold of removal is too high "
153 "(asked to remove %d features out of %d)! Please use a smaller "
154 "number for removal using set_num_remove() call",
155 threshold, argsorted.
vlen);
176 return reduced_feats;
182 "Only N_LARGEST and PERCENTILE_LARGEST removal policy can work "
196 for (
index_t i=0; i<labels_matrix.num_cols; ++i)
CFeatures * m_labels_feats
virtual const char * get_name() const =0
virtual float64_t get_value(int32_t idx)
The class Labels models labels, i.e. class assignments of objects.
virtual int32_t get_num_labels() const =0
virtual ~CDependenceMaximization()
virtual const char * get_name() const
virtual void set_p(CFeatures *p)
virtual float64_t compute_measures(CFeatures *features, index_t idx)
Template class CFeatureSelection, base class for all feature selection preprocessors which select a s...
static void qsort(T *output, int32_t size)
CDependenceMaximization()
void display_vector(const char *name="vector", const char *prefix="") const
virtual void set_labels(CLabels *labels)
virtual void add_subset(SGVector< index_t > subset)
Class SGObject is the base class of all shogun objects.
virtual EFeatureClass get_feature_class() const =0
virtual bool init(CFeatures *features)
EMessageType get_loglevel() const
virtual CFeatures * remove_feats(CFeatures *features, SGVector< index_t > ranks)
virtual CFeatures * copy_dimension_subset(SGVector< index_t > dims)
all of classes and functions are contained in the shogun namespace
index_t get_num_features(CFeatures *features) const
EFeatureRemovalPolicy m_policy
The class Features is the base class of all feature objects.
virtual void set_labels(CLabels *labels)
virtual CFeatures * create_transformed_copy(CFeatures *features, index_t idx)
virtual void set_policy(EFeatureRemovalPolicy policy)
virtual float64_t compute_statistic()=0
virtual EFeatureType get_feature_type() const =0
virtual void set_q(CFeatures *q)
CIndependenceTest * m_estimator