Class: FSelector::EnsembleSingle

Inherits:
BaseEnsemble show all
Defined in:
lib/fselector/ensemble.rb

Overview

Note:

ensemble feature selectors share the same feature selection interface as single feature selector

feature selection by an ensemble of feature selectors that created by using a single feature selection algorithm

for the type of feature weighting algorithms, call one of the following two functions first before calling select_feature_by_score! or select_feature_by_rank! for feature selection:

  • ensemble_by_score() # ensemble scores are based on that of individual selector
  • ensemble_by_rank() # ensemble ranks are based on that of individual selector

for the type of feature subset selection algorithms, use select_feature! for feature selection (based on feature frequency count)

Instance Method Summary collapse

Methods inherited from BaseEnsemble

#algo_type, #ensemble_by_rank, #ensemble_by_score, #get_feature_ranks, #get_feature_scores

Methods inherited from Base

#algo_type, #each_class, #each_feature, #each_sample, #get_class_labels, #get_classes, #get_data, #get_data_copy, #get_feature_ranks, #get_feature_scores, #get_feature_type, #get_feature_values, #get_features, #get_opt, #get_sample_size, #select_feature!, #select_feature_by_rank!, #select_feature_by_score!, #set_classes, #set_data, #set_feature_type, #set_features, #set_opt

Methods included from ReplaceMissingValues

#replace_by_fixed_value!, #replace_by_knn_value!, #replace_by_mean_value!, #replace_by_median_value!, #replace_by_most_seen_value!

Methods included from FileIO

#data_from_csv, #data_from_libsvm, #data_from_random, #data_from_url, #data_from_weka, #data_to_csv, #data_to_libsvm, #data_to_weka

Constructor Details

#initialize(algo, nselector = 40, pdata = 0.90, sampling_method = :bootstrap_sampling, data = nil) ⇒ EnsembleSingle

initialize from a single feature selection algorithm

ref: Robust Feature Selection Using Ensemble Feature Selection Techniques



249
250
251
252
253
254
255
256
257
258
259
# File 'lib/fselector/ensemble.rb', line 249

def initialize(algo, nselector=40, pdata=0.90, sampling_method=:bootstrap_sampling, data=nil)
  super(data)
  
  @algo = algo
  @nselector = nselector || 40
  @pdata = pdata || 0.90
  @sampling_method = sampling_method || :bootstrap_sampling
  
  # set feature selector type
  @algo_type = algo.algo_type
end