Class: FSelector::EnsembleMultiple

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 multiple algorithms of the same type

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(*algos) ⇒ EnsembleMultiple

Note:

different algorithms must be of the same type, either weighting or subset selection (see README)

initialize from multiple algorithms

Parameters:

  • algos (Array)

    multiple feature selection algorithms



404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/fselector/ensemble.rb', line 404

def initialize(*algos)
  super(nil)
  
  @algos = []
  algos.each do |r|
    @algos << r
  end
  
  @algo_type = algos.first.algo_type
  # all algorithms must be of the same type
  algos.each do |r|
    abort "[#{__FILE__}@#{__LINE__}]: \n"+
          "  all algorithms must be of the same type" if not r.algo_type == @algo_type
  end
end