From 7b74823aacdeda3d93e5f8236a9d35170af43252 Mon Sep 17 00:00:00 2001 From: Tiejun Cheng Date: Mon, 2 Apr 2012 15:38:17 -0400 Subject: [PATCH] update documentation to version 2.0 --- .yardopts | 2 +- doc/Array.html | 100 ++- doc/Discretilizer.html | 28 +- doc/Entropy.html | 382 ++++++++++ doc/FSelector.html | 106 ++- doc/FSelector/Accuracy.html | 6 +- doc/FSelector/AccuracyBalanced.html | 6 +- doc/FSelector/Base.html | 678 +++++++++--------- doc/FSelector/BaseCFS.html | 168 +++++ doc/FSelector/BaseContinuous.html | 14 +- doc/FSelector/BaseDiscrete.html | 12 +- doc/FSelector/BaseRelief.html | 278 +++++++ doc/FSelector/BaseReliefF.html | 297 ++++++++ doc/FSelector/BiNormalSeparation.html | 6 +- doc/FSelector/CFS_c.html | 160 +++++ doc/FSelector/CFS_d.html | 174 +++++ doc/FSelector/ChiSquaredTest.html | 6 +- doc/FSelector/CorrelationCoefficient.html | 6 +- doc/FSelector/DocumentFrequency.html | 6 +- doc/FSelector/Ensemble.html | 38 +- doc/FSelector/F1Measure.html | 6 +- doc/FSelector/FastCorrelationBasedFilter.html | 257 +++++++ doc/FSelector/FishersExactTest.html | 6 +- doc/FSelector/GMean.html | 6 +- doc/FSelector/GSSCoefficient.html | 6 +- doc/FSelector/GiniIndex.html | 6 +- doc/FSelector/InformationGain.html | 26 +- .../MatthewsCorrelationCoefficient.html | 6 +- doc/FSelector/McNemarsTest.html | 6 +- doc/FSelector/MutualInformation.html | 6 +- doc/FSelector/OddsRatio.html | 6 +- doc/FSelector/OddsRatioNumerator.html | 6 +- doc/FSelector/PMetric.html | 8 +- doc/FSelector/Power.html | 6 +- doc/FSelector/Precision.html | 6 +- doc/FSelector/ProbabilityRatio.html | 6 +- doc/FSelector/Random.html | 6 +- doc/FSelector/ReliefF_c.html | 165 +---- doc/FSelector/ReliefF_d.html | 145 +--- doc/FSelector/Relief_c.html | 146 +--- doc/FSelector/Relief_d.html | 126 +--- doc/FSelector/Sensitivity.html | 6 +- doc/FSelector/Specificity.html | 6 +- doc/FSelector/SymmetricalUncertainty.html | 175 +++++ doc/FSelector/TScore.html | 8 +- doc/FileIO.html | 34 +- doc/Normalizer.html | 16 +- doc/Rubystats.html | 4 +- doc/Rubystats/FishersExactTest.html | 76 +- doc/Rubystats/NormalDistribution.html | 98 +-- doc/String.html | 38 +- doc/_index.html | 68 +- doc/class_list.html | 2 +- doc/file.LICENSE.html | 4 +- doc/file.README.html | 61 +- doc/frames.html | 2 +- doc/index.html | 61 +- doc/method_list.html | 110 +-- doc/top-level-namespace.html | 6 +- 59 files changed, 2910 insertions(+), 1295 deletions(-) create mode 100644 doc/Entropy.html create mode 100644 doc/FSelector/BaseCFS.html create mode 100644 doc/FSelector/BaseRelief.html create mode 100644 doc/FSelector/BaseReliefF.html create mode 100644 doc/FSelector/CFS_c.html create mode 100644 doc/FSelector/CFS_d.html create mode 100644 doc/FSelector/FastCorrelationBasedFilter.html create mode 100644 doc/FSelector/SymmetricalUncertainty.html diff --git a/.yardopts b/.yardopts index 87e82f1..2224e32 100644 --- a/.yardopts +++ b/.yardopts @@ -3,4 +3,4 @@ --default-return "" --title "FSelector Documentation" --no-private ---files README.md,LICENCE lib \ No newline at end of file +--files README.md,LICENSE lib \ No newline at end of file diff --git a/doc/Array.html b/doc/Array.html index dbc39a7..f4f4ba0 100644 --- a/doc/Array.html +++ b/doc/Array.html @@ -6,7 +6,7 @@ Class: Array - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -138,6 +138,29 @@

average (mean).

+ + + +
  • + + + - pearson_r(v) + + + + + + + + + + + + +

    pearson's correlation coefficient +two vectors must be of the same length.

    +
    +
  • @@ -188,7 +211,7 @@

  • - - (Object) to_scale(min = 0.0, max = 1.0) + - to_scale(min = 0.0, max = 1.0) @@ -232,7 +255,7 @@

  • - - (Object) to_zscore + - to_zscore @@ -339,6 +362,71 @@

    Returns:

    + + +
    +

    + + - pearson_r(v) + + + +

    +
    +

    pearson's correlation coefficient +two vectors must be of the same length

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +
    +
    # File 'lib/fselector/util.rb', line 77
    +
    +def pearson_r(v)
    +  sm, vm = self.ave, v.ave
    +  a, b, c = 00, 0.0, 0.0
    +  
    +  self.each_with_index do |s, i|
    +    a += (s-sm)*(v[i]-vm)
    +    b += (s-sm)**2
    +    c += (v[i]-vm)**2
    +  end
    +  
    +  if b.zero? or c.zero?
    +    return 0.0
    +  else
    +    return a / Math.sqrt(b) / Math.sqrt(c)
    +  end
    +end
    +
    @@ -454,7 +542,7 @@

    Returns:

    - - (Object) to_scale(min = 0.0, max = 1.0) + - to_scale(min = 0.0, max = 1.0) @@ -575,7 +663,7 @@

    Returns:

    - - (Object) to_zscore + - to_zscore @@ -684,7 +772,7 @@

    Returns:

    diff --git a/doc/Discretilizer.html b/doc/Discretilizer.html index be5ab54..6c2b70c 100644 --- a/doc/Discretilizer.html +++ b/doc/Discretilizer.html @@ -6,7 +6,7 @@ Module: Discretilizer - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -109,7 +109,7 @@

  • - - (Object) discretize_chimerge!(chisq) + - discretize_by_chimerge!(chisq) @@ -131,7 +131,7 @@

  • - - (Object) discretize_equal_frequency!(n_interval) + - discretize_by_equal_frequency!(n_interval) @@ -153,7 +153,7 @@

  • - - (Object) discretize_equal_width!(n_interval) + - discretize_by_equal_width!(n_interval) @@ -182,9 +182,9 @@

    Instance Method Details

    -

    +

    - - (Object) discretize_chimerge!(chisq) + - discretize_by_chimerge!(chisq) @@ -341,7 +341,7 @@

    Parameters:

    # File 'lib/fselector/algo_continuous/discretizer.rb', line 87
     
    -def discretize_chimerge!(chisq)
    +def discretize_by_chimerge!(chisq)
       # chisq = 4.60 # for iris::Sepal.Length
       # for intialization
       hzero = {}
    @@ -441,9 +441,9 @@ 

    Parameters:

    -

    +

    - - (Object) discretize_equal_frequency!(n_interval) + - discretize_by_equal_frequency!(n_interval) @@ -518,7 +518,7 @@

    Parameters:

    # File 'lib/fselector/algo_continuous/discretizer.rb', line 42
     
    -def discretize_equal_frequency!(n_interval)
    +def discretize_by_equal_frequency!(n_interval)
       n_interval = 1 if n_interval < 1 # at least one interval
       
       # first determine the boundaries
    @@ -549,9 +549,9 @@ 

    Parameters:

    -

    +

    - - (Object) discretize_equal_width!(n_interval) + - discretize_by_equal_width!(n_interval) @@ -626,7 +626,7 @@

    Parameters:

    # File 'lib/fselector/algo_continuous/discretizer.rb', line 10
     
    -def discretize_equal_width!(n_interval)
    +def discretize_by_equal_width!(n_interval)
       n_interval = 1 if n_interval < 1 # at least one interval
       
       # first determine min and max for each feature
    @@ -661,7 +661,7 @@ 

    Parameters:

    diff --git a/doc/Entropy.html b/doc/Entropy.html new file mode 100644 index 0000000..42590e1 --- /dev/null +++ b/doc/Entropy.html @@ -0,0 +1,382 @@ + + + + + + Module: Entropy + + — FSelector Documentation + + + + + + + + + + + + + + + + + + + + + + +

    Module: Entropy + + + +

    + +
    + + + + + + + +
    Included in:
    +
    FSelector::CFS_d, FSelector::InformationGain
    + + + +
    Defined in:
    +
    lib/fselector/entropy.rb
    + +
    +
    + +

    Overview

    +
    +

    entropy-related functions for discrete data

    + + +
    +
    +
    + + +
    + + + + + + + +

    + Instance Method Summary + (collapse) +

    + + + + + + +
    +

    Instance Method Details

    + + +
    +

    + + - get_conditional_entropy(arrX, arrY) + + + +

    +
    +

    get the conditional entropy of array (X) given another array (Y)

    + +

    H(X|Y) = sigmaj (P(yj) * H(C|y_j))

    + +

    where H(X|yj) = -1 * sigmai (P(xi|yj) logP(xi|yj))

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +
    +
    # File 'lib/fselector/entropy.rb', line 30
    +
    +def get_conditional_entropy(arrX, arrY)
    +abort "[#{__FILE__}@#{__LINE__}]: "+
    +      "array must be of same length" if not arrX.size == arrY.size
    +    
    +  hxy = 0.0
    +n = arrX.size.to_f
    +
    +arrY.uniq.each do |y_j|
    +  p1 = arrY.count(y_j)/n
    +  
    +  indices = (0...n).to_a.select { |k| arrY[k] == y_j }
    +  xvs = arrX.values_at(*indices)
    +  m = xvs.size.to_f
    +  
    +  xvs.uniq.each do |x_i|
    +    p2 = xvs.count(x_i)/m
    +  
    +  hxy += -1.0 * p1 * (p2 * Math.log2(p2))
    +  end
    +end
    +
    +hxy
    +end
    +
    +
    + +
    +

    + + - get_joint_entropy(arrX, arrY) + + + +

    +
    +

    get the joint entropy of array (X) and array (Y)

    + +

    H(X,Y) = H(Y) + H(X|Y) + = H(X) + H(Y|X)

    + +

    i.e. H(X,Y) == H(Y,X)

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +63
    +64
    +65
    +66
    +67
    +68
    +
    +
    # File 'lib/fselector/entropy.rb', line 63
    +
    +def get_joint_entropy(arrX, arrY)
    +  abort "[#{__FILE__}@#{__LINE__}]: "+
    +      "array must be of same length" if not arrX.size == arrY.size
    +
    +  get_marginal_entropy(arrY) + get_conditional_entropy(arrX, arrY)  
    +end
    +
    +
    + +
    +

    + + - get_marginal_entropy(arrX) + + + +

    +
    +

    get the marginal entropy of array (X)

    + +

    H(X) = -1 * sigmai (P(xi) logP(x_i))

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +
    +
    # File 'lib/fselector/entropy.rb', line 10
    +
    +def get_marginal_entropy(arrX)
    +  h = 0.0
    +  n = arrX.size.to_f
    +
    +arrX.uniq.each do |x_i|
    +  p = arrX.count(x_i)/n
    +  h += -1.0 * (p * Math.log2(p))
    +end
    +
    +h
    +end
    +
    +
    + +
    + +
    + + + + + \ No newline at end of file diff --git a/doc/FSelector.html b/doc/FSelector.html index 3d218d5..599e582 100644 --- a/doc/FSelector.html +++ b/doc/FSelector.html @@ -6,7 +6,7 @@ Module: FSelector - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -73,7 +73,7 @@
    Defined in:
    lib/fselector.rb,
    - lib/fselector/base.rb,
    lib/fselector/ensemble.rb,
    lib/fselector/base_discrete.rb,
    lib/fselector/base_continuous.rb,
    lib/fselector/algo_discrete/GMean.rb,
    lib/fselector/algo_discrete/Power.rb,
    lib/fselector/algo_discrete/Random.rb,
    lib/fselector/algo_discrete/Accuracy.rb,
    lib/fselector/algo_continuous/TScore.rb,
    lib/fselector/algo_discrete/Relief_d.rb,
    lib/fselector/algo_continuous/PMetric.rb,
    lib/fselector/algo_discrete/GiniIndex.rb,
    lib/fselector/algo_discrete/ReliefF_d.rb,
    lib/fselector/algo_discrete/OddsRatio.rb,
    lib/fselector/algo_discrete/Precision.rb,
    lib/fselector/algo_discrete/F1Measure.rb,
    lib/fselector/algo_continuous/Relief_c.rb,
    lib/fselector/algo_discrete/Specificity.rb,
    lib/fselector/algo_discrete/Sensitivity.rb,
    lib/fselector/algo_continuous/ReliefF_c.rb,
    lib/fselector/algo_discrete/McNemarsTest.rb,
    lib/fselector/algo_discrete/ChiSquaredTest.rb,
    lib/fselector/algo_discrete/GSSCoefficient.rb,
    lib/fselector/algo_discrete/InformationGain.rb,
    lib/fselector/algo_discrete/FishersExactTest.rb,
    lib/fselector/algo_discrete/ProbabilityRatio.rb,
    lib/fselector/algo_discrete/AccuracyBalanced.rb,
    lib/fselector/algo_discrete/DocumentFrequency.rb,
    lib/fselector/algo_discrete/MutualInformation.rb,
    lib/fselector/algo_discrete/OddsRatioNumerator.rb,
    lib/fselector/algo_discrete/BiNormalSeparation.rb,
    lib/fselector/algo_discrete/CorrelationCoefficient.rb,
    lib/fselector/algo_discrete/MatthewsCorrelationCoefficient.rb
    + lib/fselector/ensemble.rb,
    lib/fselector/algo_base/base.rb,
    lib/fselector/algo_base/base_CFS.rb,
    lib/fselector/algo_discrete/GMean.rb,
    lib/fselector/algo_discrete/Power.rb,
    lib/fselector/algo_discrete/CFS_d.rb,
    lib/fselector/algo_discrete/Random.rb,
    lib/fselector/algo_base/base_Relief.rb,
    lib/fselector/algo_continuous/CFS_c.rb,
    lib/fselector/algo_discrete/Accuracy.rb,
    lib/fselector/algo_continuous/TScore.rb,
    lib/fselector/algo_discrete/Relief_d.rb,
    lib/fselector/algo_base/base_ReliefF.rb,
    lib/fselector/algo_base/base_discrete.rb,
    lib/fselector/algo_discrete/Precision.rb,
    lib/fselector/algo_discrete/OddsRatio.rb,
    lib/fselector/algo_discrete/F1Measure.rb,
    lib/fselector/algo_continuous/PMetric.rb,
    lib/fselector/algo_discrete/ReliefF_d.rb,
    lib/fselector/algo_discrete/GiniIndex.rb,
    lib/fselector/algo_continuous/Relief_c.rb,
    lib/fselector/algo_base/base_continuous.rb,
    lib/fselector/algo_discrete/Specificity.rb,
    lib/fselector/algo_discrete/Sensitivity.rb,
    lib/fselector/algo_continuous/ReliefF_c.rb,
    lib/fselector/algo_discrete/McNemarsTest.rb,
    lib/fselector/algo_discrete/GSSCoefficient.rb,
    lib/fselector/algo_discrete/ChiSquaredTest.rb,
    lib/fselector/algo_discrete/InformationGain.rb,
    lib/fselector/algo_discrete/ProbabilityRatio.rb,
    lib/fselector/algo_discrete/AccuracyBalanced.rb,
    lib/fselector/algo_discrete/FishersExactTest.rb,
    lib/fselector/algo_discrete/MutualInformation.rb,
    lib/fselector/algo_discrete/DocumentFrequency.rb,
    lib/fselector/algo_discrete/OddsRatioNumerator.rb,
    lib/fselector/algo_discrete/BiNormalSeparation.rb,
    lib/fselector/algo_discrete/SymmetricalUncertainty.rb,
    lib/fselector/algo_discrete/CorrelationCoefficient.rb,
    lib/fselector/algo_discrete/FastCorrelationBasedFilter.rb,
    lib/fselector/algo_discrete/MatthewsCorrelationCoefficient.rb
    @@ -95,7 +95,7 @@

    Overview

    -
    '0.1.0'
    +
    '0.1.2'
    GM =
    @@ -164,10 +164,10 @@

    Constant Summary

    TScore
    -
    PM = +
    Odd =
    -

    shortcut so that you can use FSelector::PM instead of FSelector::PMetric

    +

    shortcut so that you can use FSelector::Odd instead of FSelector::OddsRatio

    @@ -177,12 +177,12 @@

    Constant Summary

    -
    PMetric
    +
    OddsRatio
    -
    GI = +
    F1 =
    -

    shortcut so that you can use FSelector::GI instead of FSelector::GiniIndex

    +

    shortcut so that you can use FSelector::F1 instead of FSelector::F1Measure

    @@ -192,12 +192,12 @@

    Constant Summary

    -
    GiniIndex
    +
    F1Measure
    -
    Odd = +
    PM =
    -

    shortcut so that you can use FSelector::Odd instead of FSelector::OddsRatio

    +

    shortcut so that you can use FSelector::PM instead of FSelector::PMetric

    @@ -207,12 +207,12 @@

    Constant Summary

    -
    OddsRatio
    +
    PMetric
    -
    F1 = +
    GI =
    -

    shortcut so that you can use FSelector::F1 instead of FSelector::F1Measure

    +

    shortcut so that you can use FSelector::GI instead of FSelector::GiniIndex

    @@ -222,7 +222,7 @@

    Constant Summary

    -
    F1Measure
    +
    GiniIndex
    SP =
    @@ -284,10 +284,10 @@

    Constant Summary

    McNemarsTest
    -
    CHI = +
    GSS =
    -

    shortcut so that you can use FSelector::CHI instead of FSelector::ChiSquaredTest

    +

    shortcut so that you can use FSelector::GSS instead of FSelector::GSSCoefficient

    @@ -297,12 +297,12 @@

    Constant Summary

    -
    ChiSquaredTest
    +
    GSSCoefficient
    -
    GSS = +
    CHI =
    -

    shortcut so that you can use FSelector::GSS instead of FSelector::GSSCoefficient

    +

    shortcut so that you can use FSelector::CHI instead of FSelector::ChiSquaredTest

    @@ -312,7 +312,7 @@

    Constant Summary

    -
    GSSCoefficient
    +
    ChiSquaredTest
    IG =
    @@ -329,10 +329,10 @@

    Constant Summary

    InformationGain
    -
    FET = +
    PR =
    -

    shortcut so that you can use FSelector::FET instead of FSelector::FishersExactTest

    +

    shortcut so that you can use FSelector::PR instead of FSelector::ProbabilityRatio

    @@ -342,12 +342,12 @@

    Constant Summary

    -
    FishersExactTest
    +
    ProbabilityRatio
    -
    PR = +
    Acc2 =
    -

    shortcut so that you can use FSelector::PR instead of FSelector::ProbabilityRatio

    +

    shortcut so that you can use FSelector::Acc2 instead of FSelector::AccuracyBalanced

    @@ -357,12 +357,12 @@

    Constant Summary

    -
    ProbabilityRatio
    +
    AccuracyBalanced
    -
    Acc2 = +
    FET =
    -

    shortcut so that you can use FSelector::Acc2 instead of FSelector::AccuracyBalanced

    +

    shortcut so that you can use FSelector::FET instead of FSelector::FishersExactTest

    @@ -372,12 +372,12 @@

    Constant Summary

    -
    AccuracyBalanced
    +
    FishersExactTest
    -
    DF = +
    MI =
    -

    shortcut so that you can use FSelector::DF instead of FSelector::DocumentFrequency

    +

    shortcut so that you can use FSelector::MI instead of FSelector::MutualInformation

    @@ -387,12 +387,12 @@

    Constant Summary

    -
    DocumentFrequency
    +
    MutualInformation
    -
    MI = +
    DF =
    -

    shortcut so that you can use FSelector::MI instead of FSelector::MutualInformation

    +

    shortcut so that you can use FSelector::DF instead of FSelector::DocumentFrequency

    @@ -402,7 +402,7 @@

    Constant Summary

    -
    MutualInformation
    +
    DocumentFrequency
    OddN =
    @@ -434,6 +434,21 @@

    Constant Summary

    BiNormalSeparation
    +
    SU = +
    +
    +

    shortcut so that you can use FSelector::SU instead of FSelector::SymmetricalUncertainty

    + + +
    +
    +
    + + +
    +
    +
    SymmetricalUncertainty
    +
    CC =
    @@ -449,6 +464,21 @@

    Constant Summary

    CorrelationCoefficient
    +
    FCBF = +
    +
    +

    shortcut so that you can use FSelector::FCBF instead of FSelector::FastCorrelationBasedFilter

    + + +
    +
    +
    + + +
    +
    +
    FastCorrelationBasedFilter
    +
    MCC =
    @@ -493,7 +523,7 @@

    Constant Summary

    diff --git a/doc/FSelector/Accuracy.html b/doc/FSelector/Accuracy.html index e763de7..8b127fa 100644 --- a/doc/FSelector/Accuracy.html +++ b/doc/FSelector/Accuracy.html @@ -6,7 +6,7 @@ Class: FSelector::Accuracy - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -137,7 +137,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -159,7 +159,7 @@

    Constructor Details

    diff --git a/doc/FSelector/AccuracyBalanced.html b/doc/FSelector/AccuracyBalanced.html index 34d159a..5b0940b 100644 --- a/doc/FSelector/AccuracyBalanced.html +++ b/doc/FSelector/AccuracyBalanced.html @@ -6,7 +6,7 @@ Class: FSelector::AccuracyBalanced - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -137,7 +137,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -159,7 +159,7 @@

    Constructor Details

  • diff --git a/doc/FSelector/Base.html b/doc/FSelector/Base.html index 977f214..961a4a9 100644 --- a/doc/FSelector/Base.html +++ b/doc/FSelector/Base.html @@ -6,7 +6,7 @@ Class: FSelector::Base - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -91,7 +91,7 @@
    Defined in:
    -
    lib/fselector/base.rb
    +
    lib/fselector/algo_base/base.rb
    @@ -108,7 +108,7 @@

    Overview

    @@ -128,7 +128,7 @@

  • - - (Object) each_class + - each_class @@ -150,7 +150,7 @@

  • - - (Object) each_feature + - each_feature @@ -172,7 +172,7 @@

  • - - (Object) each_sample + - each_sample @@ -194,7 +194,7 @@

  • - - (Object) get_classes + - get_class_labels @@ -207,7 +207,7 @@

    -

    get classes.

    +

    get class labels.

  • @@ -216,7 +216,7 @@

  • - - (Object) get_data + - get_classes @@ -229,7 +229,7 @@

    -

    get data.

    +

    get classes.

  • @@ -238,7 +238,7 @@

  • - - (Hash) get_feature_ranks + - get_data @@ -251,7 +251,7 @@

    -

    get the ranked features based on their best scores.

    +

    get data.

  • @@ -260,7 +260,7 @@

  • - - (Hash) get_feature_scores + - (Hash) get_feature_ranks @@ -273,7 +273,7 @@

    -

    get scores of all features for all classes.

    +

    get the ranked features based on their best scores.

  • @@ -282,7 +282,7 @@

  • - - (Object) get_feature_values(f) + - (Hash) get_feature_scores @@ -295,7 +295,7 @@

    -

    get feature values.

    +

    get scores of all features for all classes.

  • @@ -304,7 +304,7 @@

  • - - (Object) get_features + - get_feature_values(f, mv = nil, ck = nil) @@ -317,7 +317,7 @@

    -

    get unique features.

    +

    get feature values.

  • @@ -326,7 +326,7 @@

  • - - (Object) get_opt(key) + - get_features @@ -339,7 +339,7 @@

    -

    get non-data information.

    +

    get unique features.

  • @@ -348,7 +348,7 @@

  • - - (Object) get_sample_size + - get_opt(key) @@ -361,7 +361,7 @@

    -

    number of samples.

    +

    get non-data information.

  • @@ -370,14 +370,12 @@

  • - - (Base) initialize(data = nil) + - get_sample_size - constructor - @@ -385,7 +383,7 @@

    -

    initialize from an existing data structure.

    +

    number of samples.

  • @@ -394,12 +392,14 @@

  • - - (Object) print_feature_ranks + - (Base) initialize(data = nil) + constructor + @@ -407,7 +407,7 @@

    -

    print feature ranks.

    +

    initialize from an existing data structure.

  • @@ -416,7 +416,7 @@

  • - - (Object) print_feature_scores(feat = nil, kclass = nil) + - (Hash) select_feature! @@ -429,7 +429,7 @@

    -

    print feature scores.

    +

    reconstruct data with selected features.

  • @@ -438,7 +438,7 @@

  • - - (Hash) select_data_by_rank!(criterion, my_ranks = nil) + - (Hash) select_feature_by_rank!(criterion, my_ranks = nil) @@ -460,7 +460,7 @@

  • - - (Hash) select_data_by_score!(criterion, my_scores = nil) + - (Hash) select_feature_by_score!(criterion, my_scores = nil) @@ -482,7 +482,7 @@

  • - - (Object) set_classes(classes) + - set_classes(classes) @@ -504,7 +504,7 @@

  • - - (Object) set_data(data) + - set_data(data) @@ -526,29 +526,7 @@

  • - - (Object) set_feature_score(f, k, s) - - - - - - - - - - - - -

    set feature (f) score (f) for class (k).

    -
    - -
  • - - -
  • - - - - (Object) set_features(features) + - set_features(features) @@ -570,7 +548,7 @@

  • - - (Object) set_opt(key, value) + - set_opt(key, value) @@ -634,7 +612,7 @@

    Constructor Details

    16 -
    # File 'lib/fselector/base.rb', line 13
    +      
    # File 'lib/fselector/algo_base/base.rb', line 13
     
     def initialize(data=nil)
       @data = data
    @@ -655,7 +633,7 @@ 

    Instance Method Details

    - - (Object) each_class + - each_class @@ -691,7 +669,7 @@

    Instance Method Details

    34
    -
    # File 'lib/fselector/base.rb', line 27
    +      
    # File 'lib/fselector/algo_base/base.rb', line 27
     
     def each_class
       if not block_given?
    @@ -709,7 +687,7 @@ 

    Instance Method Details

    - - (Object) each_feature + - each_feature @@ -745,7 +723,7 @@

    Instance Method Details

    52
    -
    # File 'lib/fselector/base.rb', line 45
    +      
    # File 'lib/fselector/algo_base/base.rb', line 45
     
     def each_feature
       if not block_given?
    @@ -763,7 +741,7 @@ 

    Instance Method Details

    - - (Object) each_sample + - each_sample @@ -803,7 +781,7 @@

    Instance Method Details

    74
    -
    # File 'lib/fselector/base.rb', line 65
    +      
    # File 'lib/fselector/algo_base/base.rb', line 65
     
     def each_sample
       if not block_given?
    @@ -818,12 +796,66 @@ 

    Instance Method Details

    +
  • + +
    +

    + + - get_class_labels + + + +

    +
    +

    get class labels

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +
    +
    # File 'lib/fselector/algo_base/base.rb', line 84
    +
    +def get_class_labels
    +  if not @cv
    +    @cv = []
    +    
    +    each_sample do |k, s|
    +      @cv << k
    +    end
    +  end
    +  
    +  @cv
    +end
    +

    - - (Object) get_classes + - get_classes @@ -848,7 +880,7 @@

    Instance Method Details

    80 -
    # File 'lib/fselector/base.rb', line 78
    +      
    # File 'lib/fselector/algo_base/base.rb', line 78
     
     def get_classes
       @classes ||= @data.keys
    @@ -861,7 +893,7 @@ 

    Instance Method Details

    - - (Object) get_data + - get_data @@ -881,12 +913,12 @@

    Instance Method Details

     
     
    -130
    -131
    -132
    +161 +162 +163
    -
    # File 'lib/fselector/base.rb', line 130
    +      
    # File 'lib/fselector/algo_base/base.rb', line 161
     
     def get_data
       @data
    @@ -936,6 +968,16 @@ 

    Returns:

     
     
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +235
    +236
     237
     238
     239
    @@ -944,20 +986,10 @@ 

    Returns:

    242 243 244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255
    +245
    -
    # File 'lib/fselector/base.rb', line 237
    +      
    # File 'lib/fselector/algo_base/base.rb', line 227
     
     def get_feature_ranks
       return @ranks if @ranks # already done
    @@ -1024,6 +1056,9 @@ 

    Returns:

     
     
    +204
    +205
    +206
     207
     208
     209
    @@ -1036,13 +1071,10 @@ 

    Returns:

    216 217 218 -219 -220 -221 -222
    +219
    -
    # File 'lib/fselector/base.rb', line 207
    +      
    # File 'lib/fselector/algo_base/base.rb', line 204
     
     def get_feature_scores
       return @scores if @scores # already done
    @@ -1068,7 +1100,7 @@ 

    Returns:

    - - (Object) get_feature_values(f) + - get_feature_values(f, mv = nil, ck = nil) @@ -1076,6 +1108,8 @@

    Returns:

    get feature values

    +

    values for the specific class (ck)

    +
    @@ -1098,6 +1132,43 @@

    Parameters:

  • +
  • + + mv + + + (Symbol) + + + (defaults to: nil) + + + — +

    including missing feature values? +don't include missing feature values (recorded as nils) +if mv==nil, include otherwise

    +
    + +
  • + +
  • + + ck + + + (Symbol) + + + (defaults to: nil) + + + — +

    class of interest. +return feature values for all classes, otherwise return feature

    +
    + +
  • + @@ -1107,33 +1178,53 @@

    Parameters:

     
     
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 -
    # File 'lib/fselector/base.rb', line 105
    +      
    # File 'lib/fselector/algo_base/base.rb', line 125
     
    -def get_feature_values(f)
    +def get_feature_values(f, mv=nil, ck=nil)
       @fvs ||= {}
       
       if not @fvs.has_key? f
    -    @fvs[f] = []
    +    @fvs[f] = {}
    +    
         each_sample do |k, s|
    -      @fvs[f] << s[f] if s.has_key? f
    +      @fvs[f][k] = [] if not @fvs[f].has_key? k
    +      if s.has_key? f
    +        @fvs[f][k] << s[f]
    +      else
    +        @fvs[f][k] << nil # for missing featue values
    +      end
         end
       end
       
    -  @fvs[f]
    +  if mv # include missing feature values
    +    return ck ? @fvs[f][ck] : @fvs[f].values.flatten
    +  else # don't include
    +    return ck ? @fvs[f][ck].compact : @fvs[f].values.flatten.compact
    +  end  
     end
    @@ -1143,7 +1234,7 @@

    Parameters:

    - - (Object) get_features + - get_features @@ -1163,12 +1254,12 @@

    Parameters:

     
     
    -95
    -96
    -97
    +109 +110 +111
    -
    # File 'lib/fselector/base.rb', line 95
    +      
    # File 'lib/fselector/algo_base/base.rb', line 109
     
     def get_features
       @features ||= @data.map { |x| x[1].map { |y| y.keys } }.flatten.uniq
    @@ -1181,7 +1272,7 @@ 

    Parameters:

    - - (Object) get_opt(key) + - get_opt(key) @@ -1201,12 +1292,12 @@

    Parameters:

     
     
    -150
    -151
    -152
    +182 +183 +184
    -
    # File 'lib/fselector/base.rb', line 150
    +      
    # File 'lib/fselector/algo_base/base.rb', line 182
     
     def get_opt(key)
       @opts.has_key?(key) ? @opts[key] : nil
    @@ -1219,7 +1310,7 @@ 

    Parameters:

    - - (Object) get_sample_size + - get_sample_size @@ -1239,12 +1330,12 @@

    Parameters:

     
     
    -162
    -163
    -164
    +194 +195 +196
    -
    # File 'lib/fselector/base.rb', line 162
    +      
    # File 'lib/fselector/algo_base/base.rb', line 194
     
     def get_sample_size
       @sz ||= get_data.values.flatten.size
    @@ -1255,132 +1346,93 @@ 

    Parameters:

    -

    - - (Object) print_feature_ranks + - (Hash) select_feature!

    -

    print feature ranks

    - - -
    + +
    + Note: +

    derived class must implement its own get_subset()

    -
    - - -
    - - - - -
    -
    -
    -
    -192
    -193
    -194
    -195
    -196
    -197
    -198
    -
    -
    # File 'lib/fselector/base.rb', line 192
    +  
     
    -def print_feature_ranks
    -  ranks = get_feature_ranks
    -  
    -  ranks.each do |f, r|
    -    puts "#{f} => #{r}"
    -  end
    -end
    -
    -
    - -
    -
    -
    -

    print feature scores

    +

    reconstruct data with selected features

    -

    Parameters:

    -
      + +

      Returns:

      +
      • - kclass - - (String) + (Hash) - (defaults to: nil) - — -

        class of interest

        +

        data after feature selection

      -
    @@ -1388,9 +1440,9 @@

    Parameters:

    -

    +

    - - (Hash) select_data_by_rank!(criterion, my_ranks = nil) + - (Hash) select_feature_by_rank!(criterion, my_ranks = nil) @@ -1470,30 +1522,30 @@

    Returns:

     
     
    -299
    -300
    -301
    -302
    -303
    -304
    -305
    -306
    -307
    -308
    -309
    -310
    -311
    -312
    -313
    -314
    -315
     316
    -317
    +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334
     
     
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    -182
    -183
    -184
    -185
    -186
    -187
    -188
    +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272
    -
    # File 'lib/fselector/base.rb', line 172
    +      
    # File 'lib/fselector/algo_base/base.rb', line 254
     
    -def print_feature_scores(feat=nil, kclass=nil)
    -  scores = get_feature_scores
    +def select_feature!
    +  subset = get_feature_subset
    +  return if subset.empty?
    +  
    +  my_data = {}
       
    -  scores.each do |f, ks|
    -    next if feat and feat != f
    +  each_sample do |k, s|
    +    my_data[k] ||= []
    +    my_s = {}
         
    -    print "#{f} =>"
    -    ks.each do |k, s|
    -      if kclass
    -        print " #{k}->#{s}" if k == kclass
    -      else
    -        print " #{k}->#{s}"
    -      end
    +    s.each do |f, v|
    +      my_s[f] = v if subset.include? f
         end
    -    puts
    +    
    +    my_data[k] << my_s if not my_s.empty?
       end
    +  
    +  set_data(my_data)
     end
    -
    # File 'lib/fselector/base.rb', line 299
    +      
    # File 'lib/fselector/algo_base/base.rb', line 316
     
    -def select_data_by_rank!(criterion, my_ranks=nil)
    +def select_feature_by_rank!(criterion, my_ranks=nil)
       # user ranks or internal ranks
       ranks = my_ranks || get_feature_ranks
       
    @@ -1518,9 +1570,9 @@ 

    Returns:

    -

    +

    - - (Hash) select_data_by_score!(criterion, my_scores = nil) + - (Hash) select_feature_by_score!(criterion, my_scores = nil) @@ -1600,30 +1652,30 @@

    Returns:

     
     
    -268
    -269
    -270
    -271
    -272
    -273
    -274
    -275
    -276
    -277
    -278
    -279
    -280
    -281
    -282
    -283
    -284
     285
    -286
    +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303
    -
    # File 'lib/fselector/base.rb', line 268
    +      
    # File 'lib/fselector/algo_base/base.rb', line 285
     
    -def select_data_by_score!(criterion, my_scores=nil)
    +def select_feature_by_score!(criterion, my_scores=nil)
       # user scores or internal scores
       scores = my_scores || get_feature_scores
       
    @@ -1650,7 +1702,7 @@ 

    Returns:

    - - (Object) set_classes(classes) + - set_classes(classes) @@ -1670,17 +1722,17 @@

    Returns:

     
     
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    +98 +99 +100 +101 +102 +103 +104 +105
    -
    # File 'lib/fselector/base.rb', line 84
    +      
    # File 'lib/fselector/algo_base/base.rb', line 98
     
     def set_classes(classes)
       if classes and classes.class == Array
    @@ -1698,7 +1750,7 @@ 

    Returns:

    - - (Object) set_data(data) + - set_data(data) @@ -1718,21 +1770,21 @@

    Returns:

     
     
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178
    -
    # File 'lib/fselector/base.rb', line 135
    +      
    # File 'lib/fselector/algo_base/base.rb', line 167
     
     def set_data(data)
       if data and data.class == Hash
    @@ -1749,54 +1801,12 @@ 

    Returns:

    -
    - -
    -

    - - - (Object) set_feature_score(f, k, s) - - - -

    -
    -

    set feature (f) score (f) for class (k)

    - - -
    -
    -
    - - -
    - - - - -
    -
    -
    -
    -226
    -227
    -228
    -229
    -230
    -
    -
    # File 'lib/fselector/base.rb', line 226
    -
    -def set_feature_score(f, k, s)
    -  @scores ||= {}
    -  @scores[f] ||= {}
    -  @scores[f][k] = s
    -end
    -

    - - (Object) set_features(features) + - set_features(features) @@ -1816,17 +1826,17 @@

    Returns:

     
     
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    +150 +151 +152 +153 +154 +155 +156 +157
    -
    # File 'lib/fselector/base.rb', line 119
    +      
    # File 'lib/fselector/algo_base/base.rb', line 150
     
     def set_features(features)
       if features and features.class == Array
    @@ -1844,7 +1854,7 @@ 

    Returns:

    - - (Object) set_opt(key, value) + - set_opt(key, value) @@ -1864,12 +1874,12 @@

    Returns:

     
     
    -156
    -157
    -158
    +188 +189 +190
    -
    # File 'lib/fselector/base.rb', line 156
    +      
    # File 'lib/fselector/algo_base/base.rb', line 188
     
     def set_opt(key, value)
       @opts[key] = value
    @@ -1884,7 +1894,7 @@ 

    Returns:

    diff --git a/doc/FSelector/BaseCFS.html b/doc/FSelector/BaseCFS.html new file mode 100644 index 0000000..5b1369a --- /dev/null +++ b/doc/FSelector/BaseCFS.html @@ -0,0 +1,168 @@ + + + + + + Class: FSelector::BaseCFS + + — FSelector Documentation + + + + + + + + + + + + + + + + + + + + + + +

    Class: FSelector::BaseCFS + + + +

    + +
    + +
    Inherits:
    +
    + Base + +
      +
    • Object
    • + + + + + +
    + show all + +
    + + + + + + + + + +
    Defined in:
    +
    lib/fselector/algo_base/base_CFS.rb
    + +
    +
    + +

    Overview

    +
    + +
    + Note: +

    for simplicity, we use sequential forward search for optimal feature subset,

    +
    +
    + +

    base class for Correlation-based Feature Selection (CFS) algorithm, see specialized +versions for discrete feature (CFSd) and continuous feature (CFSc), respectively

    + +

    the original CFS that uses best first search only produces slightly better results +but demands much more computational resources

    + +

    ref: Feature Selection for Discrete and Numeric Class Machine Learning

    + + +
    +
    +
    + + +
    +

    Direct Known Subclasses

    +

    CFS_c, CFS_d

    +
    + + + + + + + + + + + + + +

    Method Summary

    + +

    Methods inherited from Base

    +

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

    + + + + + + + + +

    Methods included from FileIO

    +

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

    +
    +

    Constructor Details

    + +

    This class inherits a constructor from FSelector::Base

    + +
    + + +
    + + + + + \ No newline at end of file diff --git a/doc/FSelector/BaseContinuous.html b/doc/FSelector/BaseContinuous.html index 2330ef2..0d44eac 100644 --- a/doc/FSelector/BaseContinuous.html +++ b/doc/FSelector/BaseContinuous.html @@ -6,7 +6,7 @@ Class: FSelector::BaseContinuous - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -93,7 +93,7 @@
    Defined in:
    -
    lib/fselector/base_continuous.rb
    +
    lib/fselector/algo_base/base_continuous.rb
    @@ -110,7 +110,7 @@

    Overview

    Direct Known Subclasses

    -

    PMetric, ReliefF_c, Relief_c, TScore

    +

    PMetric, TScore

    @@ -163,7 +163,7 @@

    Methods included from Discretilizer

    -

    #discretize_chimerge!, #discretize_equal_frequency!, #discretize_equal_width!

    +

    #discretize_by_chimerge!, #discretize_by_equal_frequency!, #discretize_by_equal_width!

    @@ -183,7 +183,7 @@

    Methods included from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

    #each_class, #each_feature, #each_sample, #get_class_labels, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #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_features, #set_opt

    @@ -225,7 +225,7 @@

    Constructor Details

    19
    -
    # File 'lib/fselector/base_continuous.rb', line 17
    +      
    # File 'lib/fselector/algo_base/base_continuous.rb', line 17
     
     def initialize(data=nil)
       super(data)
    @@ -241,7 +241,7 @@ 

    Constructor Details

    diff --git a/doc/FSelector/BaseDiscrete.html b/doc/FSelector/BaseDiscrete.html index 1f66e7e..50edc60 100644 --- a/doc/FSelector/BaseDiscrete.html +++ b/doc/FSelector/BaseDiscrete.html @@ -6,7 +6,7 @@ Class: FSelector::BaseDiscrete - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -89,7 +89,7 @@
    Defined in:
    -
    lib/fselector/base_discrete.rb
    +
    lib/fselector/algo_base/base_discrete.rb
    @@ -130,7 +130,7 @@

    Overview

    @@ -183,7 +183,7 @@

    Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

    #each_class, #each_feature, #each_sample, #get_class_labels, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #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_features, #set_opt

    @@ -225,7 +225,7 @@

    Constructor Details

    35
    -
    # File 'lib/fselector/base_discrete.rb', line 33
    +      
    # File 'lib/fselector/algo_base/base_discrete.rb', line 33
     
     def initialize(data=nil)
       super(data)
    @@ -241,7 +241,7 @@ 

    Constructor Details

    diff --git a/doc/FSelector/BaseRelief.html b/doc/FSelector/BaseRelief.html new file mode 100644 index 0000000..d467467 --- /dev/null +++ b/doc/FSelector/BaseRelief.html @@ -0,0 +1,278 @@ + + + + + + Class: FSelector::BaseRelief + + — FSelector Documentation + + + + + + + + + + + + + + + + + + + + + + +

    Class: FSelector::BaseRelief + + + +

    + +
    + +
    Inherits:
    +
    + Base + +
      +
    • Object
    • + + + + + +
    + show all + +
    + + + + + + + + + +
    Defined in:
    +
    lib/fselector/algo_base/base_Relief.rb
    + +
    +
    + +

    Overview

    +
    + +
    + Note: +

    Relief applicable only to two-class problem without missing data

    +
    +
    + +

    base class for Relief algorithm, see specialized versions for discrete +feature (Reliefd) and continuous feature (Reliefc), respectively

    + +

    ref: The Feature Selection Problem: Traditional Methods and a New Algorithm

    + + +
    +
    +
    + + +
    +

    Direct Known Subclasses

    +

    Relief_c, Relief_d

    +
    + + + + + + + + +

    + Instance Method Summary + (collapse) +

    + + + + + + + + + + + + +

    Methods inherited from Base

    +

    #each_class, #each_feature, #each_sample, #get_class_labels, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #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_features, #set_opt

    + + + + + + + + +

    Methods included from FileIO

    +

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

    +
    +

    Constructor Details

    + +
    +

    + + - (BaseRelief) initialize(m = nil, data = nil) + + + +

    +
    +

    new()

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + m + + + (Integer) + + + (defaults to: nil) + + + — +

      number of samples to be used +for estimating feature contribution. max can be +the number of training samples

      +
      + +
    • + +
    • + + data + + + (Hash) + + + (defaults to: nil) + + + — +

      existing data structure

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +22
    +23
    +24
    +25
    +
    +
    # File 'lib/fselector/algo_base/base_Relief.rb', line 22
    +
    +def initialize(m=nil, data=nil)
    +  super(data)
    +  @m = (m || 30) # default 30
    +end
    +
    +
    + +
    + + +
    + + + + + \ No newline at end of file diff --git a/doc/FSelector/BaseReliefF.html b/doc/FSelector/BaseReliefF.html new file mode 100644 index 0000000..9105065 --- /dev/null +++ b/doc/FSelector/BaseReliefF.html @@ -0,0 +1,297 @@ + + + + + + Class: FSelector::BaseReliefF + + — FSelector Documentation + + + + + + + + + + + + + + + + + + + + + + +

    Class: FSelector::BaseReliefF + + + +

    + +
    + +
    Inherits:
    +
    + Base + +
      +
    • Object
    • + + + + + +
    + show all + +
    + + + + + + + + + +
    Defined in:
    +
    lib/fselector/algo_base/base_ReliefF.rb
    + +
    +
    + +

    Overview

    +
    + +
    + Note: +

    applicable to multi-class problem with missing data

    +
    +
    + +

    base class for extended Relief algorithm (ReliefF), see specialized versions for +discrete feature (ReliefFd) and continuous feature (ReliefFc), respectively

    + +

    ref: Estimating Attributes: Analysis and Extensions of RELIEF

    + + +
    +
    +
    + + +
    +

    Direct Known Subclasses

    +

    ReliefF_c, ReliefF_d

    +
    + + + + + + + + +

    + Instance Method Summary + (collapse) +

    + + + + + + + + + + + + +

    Methods inherited from Base

    +

    #each_class, #each_feature, #each_sample, #get_class_labels, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #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_features, #set_opt

    + + + + + + + + +

    Methods included from FileIO

    +

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

    +
    +

    Constructor Details

    + +
    +

    + + - (BaseReliefF) initialize(m = nil, k = nil, data = nil) + + + +

    +
    +

    new()

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + m + + + (Integer) + + + (defaults to: nil) + + + — +

      number of samples to be used +for estimating feature contribution. max can be +the number of training samples

      +
      + +
    • + +
    • + + k + + + (Integer) + + + (defaults to: nil) + + + — +

      number of k-nearest neighbor

      +
      + +
    • + +
    • + + data + + + (Hash) + + + (defaults to: nil) + + + — +

      existing data structure

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +23
    +24
    +25
    +26
    +27
    +
    +
    # File 'lib/fselector/algo_base/base_ReliefF.rb', line 23
    +
    +def initialize(m=nil, k=nil, data=nil)
    +  super(data)
    +  @m = (m || 30) # default 30
    +  @k = (k || 10) # default 10
    +end
    +
    +
    + +
    + + +
    + + + + + \ No newline at end of file diff --git a/doc/FSelector/BiNormalSeparation.html b/doc/FSelector/BiNormalSeparation.html index 1c824a7..6da00c8 100644 --- a/doc/FSelector/BiNormalSeparation.html +++ b/doc/FSelector/BiNormalSeparation.html @@ -6,7 +6,7 @@ Class: FSelector::BiNormalSeparation - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -158,7 +158,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -180,7 +180,7 @@

    Constructor Details

    diff --git a/doc/FSelector/CFS_c.html b/doc/FSelector/CFS_c.html new file mode 100644 index 0000000..46a573c --- /dev/null +++ b/doc/FSelector/CFS_c.html @@ -0,0 +1,160 @@ + + + + + + Class: FSelector::CFS_c + + — FSelector Documentation + + + + + + + + + + + + + + + + + + + + + + +

    Class: FSelector::CFS_c + + + +

    + +
    + +
    Inherits:
    +
    + BaseCFS + +
      +
    • Object
    • + + + + + + + +
    + show all + +
    + + + + + + + + + +
    Defined in:
    +
    lib/fselector/algo_continuous/CFS_c.rb
    + +
    +
    + +

    Overview

    +
    +

    Correlation-based Feature Selection (CFS) algorithm for continuous feature (CFS_c)

    + +

    ref: Feature Selection for Discrete and Numeric Class Machine Learning

    + + +
    +
    +
    + + +
    + + + + + + + + + + + + + + + + + +

    Method Summary

    + +

    Methods inherited from Base

    +

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

    + + + + + + + + +

    Methods included from FileIO

    +

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

    +
    +

    Constructor Details

    + +

    This class inherits a constructor from FSelector::Base

    + +
    + + +
    + + + + + \ No newline at end of file diff --git a/doc/FSelector/CFS_d.html b/doc/FSelector/CFS_d.html new file mode 100644 index 0000000..0dc9571 --- /dev/null +++ b/doc/FSelector/CFS_d.html @@ -0,0 +1,174 @@ + + + + + + Class: FSelector::CFS_d + + — FSelector Documentation + + + + + + + + + + + + + + + + + + + + + + +

    Class: FSelector::CFS_d + + + +

    + +
    + +
    Inherits:
    +
    + BaseCFS + +
      +
    • Object
    • + + + + + + + +
    + show all + +
    + + + + + + +
    Includes:
    +
    Entropy
    + + + + + +
    Defined in:
    +
    lib/fselector/algo_discrete/CFS_d.rb
    + +
    +
    + +

    Overview

    +
    +

    Correlation-based Feature Selection (CFS) algorithm for discrete feature (CFS_d)

    + +

    ref: Feature Selection for Discrete and Numeric Class Machine Learning

    + + +
    +
    +
    + + +
    + + + + + + + + + + + + +

    Method Summary

    + +

    Methods included from Entropy

    +

    #get_conditional_entropy, #get_joint_entropy, #get_marginal_entropy

    + + + + + + + + + + + + + +

    Methods inherited from Base

    +

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

    + + + + + + + + +

    Methods included from FileIO

    +

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

    +
    +

    Constructor Details

    + +

    This class inherits a constructor from FSelector::Base

    + +
    + + +
    + + + + + \ No newline at end of file diff --git a/doc/FSelector/ChiSquaredTest.html b/doc/FSelector/ChiSquaredTest.html index c6ffff5..cf81665 100644 --- a/doc/FSelector/ChiSquaredTest.html +++ b/doc/FSelector/ChiSquaredTest.html @@ -6,7 +6,7 @@ Class: FSelector::ChiSquaredTest - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -176,7 +176,7 @@

    Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

    #each_class, #each_feature, #each_sample, #get_class_labels, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #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_features, #set_opt

    @@ -258,7 +258,7 @@

    Parameters:

    diff --git a/doc/FSelector/CorrelationCoefficient.html b/doc/FSelector/CorrelationCoefficient.html index 7ee7379..2093ff1 100644 --- a/doc/FSelector/CorrelationCoefficient.html +++ b/doc/FSelector/CorrelationCoefficient.html @@ -6,7 +6,7 @@ Class: FSelector::CorrelationCoefficient - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -140,7 +140,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -162,7 +162,7 @@

    Constructor Details

    diff --git a/doc/FSelector/DocumentFrequency.html b/doc/FSelector/DocumentFrequency.html index d263ca4..39b698b 100644 --- a/doc/FSelector/DocumentFrequency.html +++ b/doc/FSelector/DocumentFrequency.html @@ -6,7 +6,7 @@ Class: FSelector::DocumentFrequency - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -137,7 +137,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -159,7 +159,7 @@

    Constructor Details

    diff --git a/doc/FSelector/Ensemble.html b/doc/FSelector/Ensemble.html index 1b61054..2d01a74 100644 --- a/doc/FSelector/Ensemble.html +++ b/doc/FSelector/Ensemble.html @@ -6,7 +6,7 @@ Class: FSelector::Ensemble - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -122,7 +122,7 @@

  • - - (Object) by_ave(arr) + - by_ave(arr) @@ -144,7 +144,7 @@

  • - - (Object) by_max(arr) + - by_max(arr) @@ -166,7 +166,7 @@

  • - - (Object) by_min(arr) + - by_min(arr) @@ -188,7 +188,7 @@

  • - - (Object) ensemble_by_rank(by_what = method(:by_min)) + - ensemble_by_rank(by_what = method(:by_min)) @@ -210,7 +210,7 @@

  • - - (Object) ensemble_by_score(by_what = method(:by_max), norm = :min_max) + - ensemble_by_score(by_what = method(:by_max), norm = :min_max) @@ -232,7 +232,7 @@

  • - - (Object) get_feature_ranks + - get_feature_ranks @@ -254,7 +254,7 @@

  • - - (Object) get_feature_scores + - get_feature_scores @@ -300,7 +300,7 @@

  • - - (Object) set_data(data) + - set_data(data) @@ -331,7 +331,7 @@

    Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_values, #get_features, #get_opt, #get_sample_size, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_feature_score, #set_features, #set_opt

    +

    #each_class, #each_feature, #each_sample, #get_class_labels, #get_classes, #get_data, #get_feature_values, #get_features, #get_opt, #get_sample_size, #select_feature!, #select_feature_by_rank!, #select_feature_by_score!, #set_classes, #set_features, #set_opt

    @@ -422,7 +422,7 @@

    Instance Method Details

    - - (Object) by_ave(arr) + - by_ave(arr) @@ -460,7 +460,7 @@

    Instance Method Details

    - - (Object) by_max(arr) + - by_max(arr) @@ -498,7 +498,7 @@

    Instance Method Details

    - - (Object) by_min(arr) + - by_min(arr) @@ -536,7 +536,7 @@

    Instance Method Details

    - - (Object) ensemble_by_rank(by_what = method(:by_min)) + - ensemble_by_rank(by_what = method(:by_min)) @@ -634,7 +634,7 @@

    Parameters:

    - - (Object) ensemble_by_score(by_what = method(:by_max), norm = :min_max) + - ensemble_by_score(by_what = method(:by_max), norm = :min_max) @@ -761,7 +761,7 @@

    Parameters:

    - - (Object) get_feature_ranks + - get_feature_ranks @@ -805,7 +805,7 @@

    Parameters:

    - - (Object) get_feature_scores + - get_feature_scores @@ -849,7 +849,7 @@

    Parameters:

    - - (Object) set_data(data) + - set_data(data) @@ -904,7 +904,7 @@

    Parameters:

    diff --git a/doc/FSelector/F1Measure.html b/doc/FSelector/F1Measure.html index fa6c200..6b79e11 100644 --- a/doc/FSelector/F1Measure.html +++ b/doc/FSelector/F1Measure.html @@ -6,7 +6,7 @@ Class: FSelector::F1Measure - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -143,7 +143,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -165,7 +165,7 @@

    Constructor Details

    diff --git a/doc/FSelector/FastCorrelationBasedFilter.html b/doc/FSelector/FastCorrelationBasedFilter.html new file mode 100644 index 0000000..f5465be --- /dev/null +++ b/doc/FSelector/FastCorrelationBasedFilter.html @@ -0,0 +1,257 @@ + + + + + + Class: FSelector::FastCorrelationBasedFilter + + — FSelector Documentation + + + + + + + + + + + + + + + + + + + + + + +

    Class: FSelector::FastCorrelationBasedFilter + + + +

    + +
    + +
    Inherits:
    +
    + BaseDiscrete + +
      +
    • Object
    • + + + + + + + +
    + show all + +
    + + + + + + + + + +
    Defined in:
    +
    lib/fselector/algo_discrete/FastCorrelationBasedFilter.rb
    + +
    +
    + +

    Overview

    +
    +

    Fast Correlation-Based Filter for feature with discrete data (FCBF)

    + +

    ref: Feature Selection for High-Dimensional Data: A Fast Correlation-Based Filter Solution

    + + +
    +
    +
    + + +
    + + + + + + + +

    + Instance Method Summary + (collapse) +

    + + + + + + + + + + + + + + + + + +

    Methods inherited from Base

    +

    #each_class, #each_feature, #each_sample, #get_class_labels, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #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_features, #set_opt

    + + + + + + + + +

    Methods included from FileIO

    +

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

    +
    +

    Constructor Details

    + +
    +

    + + - (FastCorrelationBasedFilter) initialize(delta = nil, data = nil) + + + +

    +
    +

    initialize from an existing data structure

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + delta + + + (Float) + + + (defaults to: nil) + + + — +

      predefined threshold. +if not provided, use 1/sqrt(alpha*m) where +alpha is confidence level and m is sample size +respectively.

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +19
    +20
    +21
    +22
    +
    +
    # File 'lib/fselector/algo_discrete/FastCorrelationBasedFilter.rb', line 19
    +
    +def initialize(delta=nil, data=nil)
    +  super(data)
    +  @delta = delta || 0.0
    +end
    +
    +
    + +
    + + +
    + + + + + \ No newline at end of file diff --git a/doc/FSelector/FishersExactTest.html b/doc/FSelector/FishersExactTest.html index 0f823ff..c923418 100644 --- a/doc/FSelector/FishersExactTest.html +++ b/doc/FSelector/FishersExactTest.html @@ -6,7 +6,7 @@ Class: FSelector::FishersExactTest - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -160,7 +160,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -182,7 +182,7 @@

    Constructor Details

    diff --git a/doc/FSelector/GMean.html b/doc/FSelector/GMean.html index a4732b1..c7e21e5 100644 --- a/doc/FSelector/GMean.html +++ b/doc/FSelector/GMean.html @@ -6,7 +6,7 @@ Class: FSelector::GMean - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -139,7 +139,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -161,7 +161,7 @@

    Constructor Details

    diff --git a/doc/FSelector/GSSCoefficient.html b/doc/FSelector/GSSCoefficient.html index 21898d1..ced3190 100644 --- a/doc/FSelector/GSSCoefficient.html +++ b/doc/FSelector/GSSCoefficient.html @@ -6,7 +6,7 @@ Class: FSelector::GSSCoefficient - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -143,7 +143,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -165,7 +165,7 @@

    Constructor Details

    diff --git a/doc/FSelector/GiniIndex.html b/doc/FSelector/GiniIndex.html index 09360d7..2f4e0e4 100644 --- a/doc/FSelector/GiniIndex.html +++ b/doc/FSelector/GiniIndex.html @@ -6,7 +6,7 @@ Class: FSelector::GiniIndex - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -140,7 +140,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -162,7 +162,7 @@

    Constructor Details

    diff --git a/doc/FSelector/InformationGain.html b/doc/FSelector/InformationGain.html index ea6017b..58cc88c 100644 --- a/doc/FSelector/InformationGain.html +++ b/doc/FSelector/InformationGain.html @@ -6,7 +6,7 @@ Class: FSelector::InformationGain - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -87,11 +87,15 @@ +
    Includes:
    +
    Entropy
    + + -
    Defined in:
    -
    lib/fselector/algo_discrete/InformationGain.rb
    +
    Defined in:
    +
    lib/fselector/algo_discrete/InformationGain.rb
    @@ -100,7 +104,7 @@

    Overview

    Information Gain for feature with discrete data (IG)

    -
    IG_d(c,f) = H(c) - H(c|f)
    +
    IG(c,f) = H(c) - H(c|f)
     
     where H(c) = -1 * sigma_i (P(ci) logP(ci))
           H(c|f) = sigma_j (P(fj)*H(c|fj))
    @@ -130,6 +134,16 @@ 

    Overview

    diff --git a/doc/FSelector/MatthewsCorrelationCoefficient.html b/doc/FSelector/MatthewsCorrelationCoefficient.html index 103fa38..085ca2c 100644 --- a/doc/FSelector/MatthewsCorrelationCoefficient.html +++ b/doc/FSelector/MatthewsCorrelationCoefficient.html @@ -6,7 +6,7 @@ Class: FSelector::MatthewsCorrelationCoefficient - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -143,7 +143,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -165,7 +165,7 @@

    Constructor Details

    diff --git a/doc/FSelector/McNemarsTest.html b/doc/FSelector/McNemarsTest.html index ac6f0f3..93a8d15 100644 --- a/doc/FSelector/McNemarsTest.html +++ b/doc/FSelector/McNemarsTest.html @@ -6,7 +6,7 @@ Class: FSelector::McNemarsTest - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -171,7 +171,7 @@

    Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

    #each_class, #each_feature, #each_sample, #get_class_labels, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #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_features, #set_opt

    @@ -253,7 +253,7 @@

    Parameters:

    diff --git a/doc/FSelector/MutualInformation.html b/doc/FSelector/MutualInformation.html index b8bf66f..a8253d6 100644 --- a/doc/FSelector/MutualInformation.html +++ b/doc/FSelector/MutualInformation.html @@ -6,7 +6,7 @@ Class: FSelector::MutualInformation - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -143,7 +143,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -165,7 +165,7 @@

    Constructor Details

    diff --git a/doc/FSelector/OddsRatio.html b/doc/FSelector/OddsRatio.html index d8bcc7f..b3e982e 100644 --- a/doc/FSelector/OddsRatio.html +++ b/doc/FSelector/OddsRatio.html @@ -6,7 +6,7 @@ Class: FSelector::OddsRatio - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -143,7 +143,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -165,7 +165,7 @@

    Constructor Details

    diff --git a/doc/FSelector/OddsRatioNumerator.html b/doc/FSelector/OddsRatioNumerator.html index 635115c..4673c4d 100644 --- a/doc/FSelector/OddsRatioNumerator.html +++ b/doc/FSelector/OddsRatioNumerator.html @@ -6,7 +6,7 @@ Class: FSelector::OddsRatioNumerator - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -141,7 +141,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -163,7 +163,7 @@

    Constructor Details

    diff --git a/doc/FSelector/PMetric.html b/doc/FSelector/PMetric.html index 829c406..3c8d30a 100644 --- a/doc/FSelector/PMetric.html +++ b/doc/FSelector/PMetric.html @@ -6,7 +6,7 @@ Class: FSelector::PMetric - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -146,7 +146,7 @@

    Methods inherited from Methods included from Discretilizer

    -

    #discretize_chimerge!, #discretize_equal_frequency!, #discretize_equal_width!

    +

    #discretize_by_chimerge!, #discretize_by_equal_frequency!, #discretize_by_equal_width!

    @@ -166,7 +166,7 @@

    Methods included from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -188,7 +188,7 @@

    Constructor Details

    diff --git a/doc/FSelector/Power.html b/doc/FSelector/Power.html index 90dd1a7..5bde2b3 100644 --- a/doc/FSelector/Power.html +++ b/doc/FSelector/Power.html @@ -6,7 +6,7 @@ Class: FSelector::Power - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -171,7 +171,7 @@

    Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

    #each_class, #each_feature, #each_sample, #get_class_labels, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #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_features, #set_opt

    @@ -252,7 +252,7 @@

    Parameters:

    diff --git a/doc/FSelector/Precision.html b/doc/FSelector/Precision.html index f2c351c..ede62b1 100644 --- a/doc/FSelector/Precision.html +++ b/doc/FSelector/Precision.html @@ -6,7 +6,7 @@ Class: FSelector::Precision - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -137,7 +137,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -159,7 +159,7 @@

    Constructor Details

    diff --git a/doc/FSelector/ProbabilityRatio.html b/doc/FSelector/ProbabilityRatio.html index f9a2d12..e29f293 100644 --- a/doc/FSelector/ProbabilityRatio.html +++ b/doc/FSelector/ProbabilityRatio.html @@ -6,7 +6,7 @@ Class: FSelector::ProbabilityRatio - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -141,7 +141,7 @@

    Methods inherited from Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #initialize, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

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

    @@ -163,7 +163,7 @@

    Constructor Details

    diff --git a/doc/FSelector/Random.html b/doc/FSelector/Random.html index 4f8d683..fa3b056 100644 --- a/doc/FSelector/Random.html +++ b/doc/FSelector/Random.html @@ -6,7 +6,7 @@ Class: FSelector::Random - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -166,7 +166,7 @@

    Methods inherited from Base

    -

    #each_class, #each_feature, #each_sample, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #get_feature_values, #get_features, #get_opt, #get_sample_size, #print_feature_ranks, #print_feature_scores, #select_data_by_rank!, #select_data_by_score!, #set_classes, #set_data, #set_feature_score, #set_features, #set_opt

    +

    #each_class, #each_feature, #each_sample, #get_class_labels, #get_classes, #get_data, #get_feature_ranks, #get_feature_scores, #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_features, #set_opt

    @@ -249,7 +249,7 @@

    Parameters:

    diff --git a/doc/FSelector/ReliefF_c.html b/doc/FSelector/ReliefF_c.html index 8a8e81a..57d329c 100644 --- a/doc/FSelector/ReliefF_c.html +++ b/doc/FSelector/ReliefF_c.html @@ -6,7 +6,7 @@ Class: FSelector::ReliefF_c - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -66,14 +66,14 @@
    Inherits:
    - BaseContinuous + BaseReliefF
  • -
    # File 'lib/fselector/util.rb', line 147
    +      
    # File 'lib/fselector/util.rb', line 167
     
     def initialize
       @sn11    = 0.0
    @@ -243,7 +243,7 @@ 

    Instance Method Details

    - - (Object) calculate(n11_, n12_, n21_, n22_) + - calculate(n11_, n12_, n21_, n22_) @@ -263,25 +263,25 @@

    Instance Method Details

     
     
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201
    -
    # File 'lib/fselector/util.rb', line 166
    +      
    # File 'lib/fselector/util.rb', line 186
     
     def calculate(n11_,n12_,n21_,n22_)
       n11_ *= -1 if n11_ < 0
    @@ -309,7 +309,7 @@ 

    Instance Method Details

    diff --git a/doc/Rubystats/NormalDistribution.html b/doc/Rubystats/NormalDistribution.html index 76fa2ee..847cc3a 100644 --- a/doc/Rubystats/NormalDistribution.html +++ b/doc/Rubystats/NormalDistribution.html @@ -6,7 +6,7 @@ Class: Rubystats::NormalDistribution - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -120,7 +120,7 @@

  • - - (Object) get_cdf(x) + - get_cdf(x) @@ -144,7 +144,7 @@

  • - - (Object) get_icdf(p) + - get_icdf(p) @@ -166,7 +166,7 @@

  • - - (Object) get_pdf(x) + - get_pdf(x) @@ -242,19 +242,19 @@

    Constructor Details

     
     
    -321
    -322
    -323
    -324
    -325
    -326
    -327
    -328
    -329
    -330
    +341 +342 +343 +344 +345 +346 +347 +348 +349 +350
  • -
    # File 'lib/fselector/util.rb', line 321
    +      
    # File 'lib/fselector/util.rb', line 341
     
     def initialize(mu=0.0, sigma=1.0)
       @mean = mu
    @@ -281,7 +281,7 @@ 

    Instance Method Details

    - - (Object) get_cdf(x) + - get_cdf(x) @@ -303,12 +303,12 @@

    Instance Method Details

     
     
    -344
    -345
    -346
    +364 +365 +366
    -
    # File 'lib/fselector/util.rb', line 344
    +      
    # File 'lib/fselector/util.rb', line 364
     
     def get_cdf(x)
       complementary_error( -(x - @mean) / @cdf_denominator) / 2
    @@ -321,7 +321,7 @@ 

    Instance Method Details

    - - (Object) get_icdf(p) + - get_icdf(p) @@ -342,26 +342,6 @@

    Instance Method Details

     
     
    -351
    -352
    -353
    -354
    -355
    -356
    -357
    -358
    -359
    -360
    -361
    -362
    -363
    -364
    -365
    -366
    -367
    -368
    -369
    -370
     371
     372
     373
    @@ -369,10 +349,30 @@ 

    Instance Method Details

    375 376 377 -378
    +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398
    -
    # File 'lib/fselector/util.rb', line 351
    +      
    # File 'lib/fselector/util.rb', line 371
     
     def get_icdf(p)
       check_range(p)
    @@ -410,7 +410,7 @@ 

    Instance Method Details

    - - (Object) get_pdf(x) + - get_pdf(x) @@ -432,12 +432,12 @@

    Instance Method Details

     
     
    -336
    -337
    -338
    +356 +357 +358
    -
    # File 'lib/fselector/util.rb', line 336
    +      
    # File 'lib/fselector/util.rb', line 356
     
     def get_pdf(x)
       Math.exp( -((x-@mean)**2) / (2 * @variance)) / @pdf_denominator
    @@ -452,7 +452,7 @@ 

    Instance Method Details

    diff --git a/doc/String.html b/doc/String.html index 1effe99..cd94e01 100644 --- a/doc/String.html +++ b/doc/String.html @@ -6,7 +6,7 @@ Class: String - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -230,12 +230,12 @@

    Returns:

     
     
    -91
    -92
    -93
    +111 +112 +113
    -
    # File 'lib/fselector/util.rb', line 91
    +      
    # File 'lib/fselector/util.rb', line 111
     
     def blank?
       return self =~ /^\s*$/
    @@ -302,12 +302,12 @@ 

    Returns:

     
     
    -85
    -86
    -87
    +105 +106 +107
    -
    # File 'lib/fselector/util.rb', line 85
    +      
    # File 'lib/fselector/util.rb', line 105
     
     def comment?(char='#')
       return self =~ /^#{char}/
    @@ -391,17 +391,17 @@ 

    Returns:

     
     
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    +127 +128 +129 +130 +131 +132 +133 +134
    -
    # File 'lib/fselector/util.rb', line 107
    +      
    # File 'lib/fselector/util.rb', line 127
     
     def split_me(delim_regex, quote_char="'")
       d, q = delim_regex, quote_char
    @@ -421,7 +421,7 @@ 

    Returns:

    diff --git a/doc/_index.html b/doc/_index.html index 32477fd..1b395c0 100644 --- a/doc/_index.html +++ b/doc/_index.html @@ -4,7 +4,7 @@ - Documentation by YARD 0.7.5 + FSelector Documentation @@ -52,7 +52,7 @@ -

    Documentation by YARD 0.7.5

    +

    FSelector Documentation

    Alphabetic Index

    @@ -117,6 +117,13 @@

    Namespace Listing A-Z

  • +
  • + BaseCFS + + (FSelector) + +
  • +
  • BaseContinuous @@ -131,6 +138,20 @@

    Namespace Listing A-Z

  • +
  • + BaseRelief + + (FSelector) + +
  • + +
  • + BaseReliefF + + (FSelector) + +
  • +
  • BiNormalSeparation @@ -146,6 +167,20 @@

    Namespace Listing A-Z

  • C
  • @@ -216,14 +256,14 @@

    Namespace Listing A-Z

  • - FileIO + FastCorrelationBasedFilter + + (FSelector)
  • - FishersExactTest - - (FSelector) + FileIO
  • @@ -234,6 +274,13 @@

    Namespace Listing A-Z

    +
  • + FishersExactTest + + (FSelector) + +
  • + @@ -463,6 +510,13 @@

    Namespace Listing A-Z

    +
  • + SymmetricalUncertainty + + (FSelector) + +
  • + @@ -490,7 +544,7 @@

    Namespace Listing A-Z

    diff --git a/doc/class_list.html b/doc/class_list.html index 4f9fe84..55ae48a 100644 --- a/doc/class_list.html +++ b/doc/class_list.html @@ -39,7 +39,7 @@

    Class List

    diff --git a/doc/file.LICENSE.html b/doc/file.LICENSE.html index 3f536cc..604289b 100644 --- a/doc/file.LICENSE.html +++ b/doc/file.LICENSE.html @@ -6,7 +6,7 @@ File: LICENSE - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -78,7 +78,7 @@ diff --git a/doc/file.README.html b/doc/file.README.html index f85d852..a3e766a 100644 --- a/doc/file.README.html +++ b/doc/file.README.html @@ -6,7 +6,7 @@ File: README - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -54,7 +54,7 @@ -

    FSelector: a Ruby package for feature selection and ranking

    +

    FSelector: a Ruby gem for feature selection and ranking

    Home https://rubygems.org/gems/fselector
    Source Code: https://github.com/need47/fselector
    @@ -63,20 +63,21 @@ Email: need47@gmail.com
    Copyright: 2012
    License: MIT License
    -Latest Version: 0.1.0
    -Release Date: March 1st 2012

    +Latest Version: 0.2.0
    +Release Date: April 1st 2012

    Synopsis

    -

    FSelector is an open-access Ruby package that aims to integrate as many -feature selection/ranking algorithms as possible. It enables the user -to perform feature selection by using either a single algorithm or an -ensemble of algorithms. FSelector acts on a full data set and outputs -a reduced data set with only selected features, which can later be used -as the input for various machine learning softwares including LibSVM and -WEKA. FSelector, itself, does not implement any of the machine learning -algorithms such as support vector machines and random forest. Below is -a summary of FSelector's features.

    +

    FSelector is a Ruby gem that aims to integrate various feature selection/ranking +algorithms into one single package. Welcome to contact me (need47@gmail.com) +if you want to contribute your own algorithms or report a bug. FSelector enables +the user to perform feature selection by using either a single algorithm or an +ensemble of algorithms. FSelector acts on a full-feature data set with CSV, LibSVM +or WEKA file format and outputs a reduced data set with only selected subset of +features, which can later be used as the input for various machine learning softwares +including LibSVM and WEKA. FSelector, itself, does not implement any of the machine +learning algorithms such as support vector machines and random forest. Below is a +summary of FSelector's features.

    Feature List

    @@ -87,11 +88,13 @@

    Feature List

    Accuracy Acc discrete AccuracyBalanced Acc2 discrete BiNormalSeparation BNS discrete +CFS_d CFS_d discrete ChiSquaredTest CHI discrete CorrelationCoefficient CC discrete DocumentFrequency DF discrete F1Measure F1 discrete FishersExactTest FET discrete +FastCorrelationBasedFilter FCBF discrete GiniIndex GI discrete GMean GM discrete GSSCoefficient GSS discrete @@ -110,6 +113,8 @@

    Feature List

    ReliefF_d ReliefF_d discrete Sensitivity SN, Recall discrete Specificity SP discrete +SymmetricalUncertainty SU discrete +CFS_c CFS_c continuous PMetric PM continuous Relief_c Relief_c continuous ReliefF_c ReliefF_c continuous @@ -173,7 +178,7 @@

    Usage

    puts "# features (before): "+ r1.get_features.size.to_s # select the top-ranked features with scores >0.01 -r1.select_data_by_score!('>0.01') +r1.select_feature_by_score!('>0.01') # number of features after feature selection puts "# features (after): "+ r1.get_features.size.to_s @@ -187,7 +192,7 @@

    Usage

    puts "# features (before): "+ r2.get_features.size.to_s # select the top-ranked 3 features -r2.select_data_by_rank!('<=3') +r2.select_feature_by_rank!('<=3') # number of features after feature selection puts "# features (after): "+ r2.get_features.size.to_s @@ -219,7 +224,7 @@

    Usage

    re.ensemble_by_rank(re.method(:by_min)) # select the top-ranked 3 features -re.select_data_by_rank!('<=3') +re.select_feature_by_rank!('<=3') # number of features after feature selection puts '# features (after): ' + re.get_features.size.to_s @@ -227,7 +232,7 @@

    Usage

    3. normalization and discretization before feature selection

    -

    In addition to the algorithms designed for continous feature, one +

    In addition to the algorithms designed for continuous feature, one can apply those deisgned for discrete feature after (optionally normalization and) discretization

    @@ -237,32 +242,38 @@

    Usage

    r1 = FSelector::BaseContinuous.new # read the Iris data set (under the test/ directory) -r1.data_from_csv(File.expand_path(File.dirname(__FILE__))+'/iris.csv') +r1.data_from_csv('test/iris.csv') # normalization by log2 (optional) # r1.normalize_log!(2) # discretization by ChiMerge algorithm # chi-squared value = 4.60 for a three-class problem at alpha=0.10 -r1.discretize_chimerge!(4.60) +r1.discretize_by_chimerge!(4.60) -# apply Relief_d for discrete feature +# apply Fast Correlation-Based Filter (FCBF) algorithm for discrete feature # initialize with discretized data from r1 -r2 = FSelector::ReliefF_d.new(r1.get_sample_size, 10, r1.get_data) +r2 = FSelector::FCBF.new(0.0, r1.get_data) -# print feature ranks -r2.print_feature_ranks +# number of features before feature selection +puts '# features (before): ' + r2.get_features.size.to_s + +# feature selection +r2.select_feature! + +# number of features after feature selection +puts '# features (after): ' + r2.get_features.size.to_s

    Copyright

    -

    FSelector © 2011-2012 by Tiejun Cheng. +

    FSelector © 2012 by Tiejun Cheng. FSelector is licensed under the MIT license. Please see the LICENSE for more information.

    diff --git a/doc/frames.html b/doc/frames.html index ff4a68c..6599678 100644 --- a/doc/frames.html +++ b/doc/frames.html @@ -4,7 +4,7 @@ - Documentation by YARD 0.7.5 + FSelector Documentation diff --git a/doc/index.html b/doc/index.html index f85d852..a3e766a 100644 --- a/doc/index.html +++ b/doc/index.html @@ -6,7 +6,7 @@ File: README - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -54,7 +54,7 @@ -

    FSelector: a Ruby package for feature selection and ranking

    +

    FSelector: a Ruby gem for feature selection and ranking

    Home https://rubygems.org/gems/fselector
    Source Code: https://github.com/need47/fselector
    @@ -63,20 +63,21 @@ Email: need47@gmail.com
    Copyright: 2012
    License: MIT License
    -Latest Version: 0.1.0
    -Release Date: March 1st 2012

    +Latest Version: 0.2.0
    +Release Date: April 1st 2012

    Synopsis

    -

    FSelector is an open-access Ruby package that aims to integrate as many -feature selection/ranking algorithms as possible. It enables the user -to perform feature selection by using either a single algorithm or an -ensemble of algorithms. FSelector acts on a full data set and outputs -a reduced data set with only selected features, which can later be used -as the input for various machine learning softwares including LibSVM and -WEKA. FSelector, itself, does not implement any of the machine learning -algorithms such as support vector machines and random forest. Below is -a summary of FSelector's features.

    +

    FSelector is a Ruby gem that aims to integrate various feature selection/ranking +algorithms into one single package. Welcome to contact me (need47@gmail.com) +if you want to contribute your own algorithms or report a bug. FSelector enables +the user to perform feature selection by using either a single algorithm or an +ensemble of algorithms. FSelector acts on a full-feature data set with CSV, LibSVM +or WEKA file format and outputs a reduced data set with only selected subset of +features, which can later be used as the input for various machine learning softwares +including LibSVM and WEKA. FSelector, itself, does not implement any of the machine +learning algorithms such as support vector machines and random forest. Below is a +summary of FSelector's features.

    Feature List

    @@ -87,11 +88,13 @@

    Feature List

    Accuracy Acc discrete AccuracyBalanced Acc2 discrete BiNormalSeparation BNS discrete +CFS_d CFS_d discrete ChiSquaredTest CHI discrete CorrelationCoefficient CC discrete DocumentFrequency DF discrete F1Measure F1 discrete FishersExactTest FET discrete +FastCorrelationBasedFilter FCBF discrete GiniIndex GI discrete GMean GM discrete GSSCoefficient GSS discrete @@ -110,6 +113,8 @@

    Feature List

    ReliefF_d ReliefF_d discrete Sensitivity SN, Recall discrete Specificity SP discrete +SymmetricalUncertainty SU discrete +CFS_c CFS_c continuous PMetric PM continuous Relief_c Relief_c continuous ReliefF_c ReliefF_c continuous @@ -173,7 +178,7 @@

    Usage

    puts "# features (before): "+ r1.get_features.size.to_s # select the top-ranked features with scores >0.01 -r1.select_data_by_score!('>0.01') +r1.select_feature_by_score!('>0.01') # number of features after feature selection puts "# features (after): "+ r1.get_features.size.to_s @@ -187,7 +192,7 @@

    Usage

    puts "# features (before): "+ r2.get_features.size.to_s # select the top-ranked 3 features -r2.select_data_by_rank!('<=3') +r2.select_feature_by_rank!('<=3') # number of features after feature selection puts "# features (after): "+ r2.get_features.size.to_s @@ -219,7 +224,7 @@

    Usage

    re.ensemble_by_rank(re.method(:by_min)) # select the top-ranked 3 features -re.select_data_by_rank!('<=3') +re.select_feature_by_rank!('<=3') # number of features after feature selection puts '# features (after): ' + re.get_features.size.to_s @@ -227,7 +232,7 @@

    Usage

    3. normalization and discretization before feature selection

    -

    In addition to the algorithms designed for continous feature, one +

    In addition to the algorithms designed for continuous feature, one can apply those deisgned for discrete feature after (optionally normalization and) discretization

    @@ -237,32 +242,38 @@

    Usage

    r1 = FSelector::BaseContinuous.new # read the Iris data set (under the test/ directory) -r1.data_from_csv(File.expand_path(File.dirname(__FILE__))+'/iris.csv') +r1.data_from_csv('test/iris.csv') # normalization by log2 (optional) # r1.normalize_log!(2) # discretization by ChiMerge algorithm # chi-squared value = 4.60 for a three-class problem at alpha=0.10 -r1.discretize_chimerge!(4.60) +r1.discretize_by_chimerge!(4.60) -# apply Relief_d for discrete feature +# apply Fast Correlation-Based Filter (FCBF) algorithm for discrete feature # initialize with discretized data from r1 -r2 = FSelector::ReliefF_d.new(r1.get_sample_size, 10, r1.get_data) +r2 = FSelector::FCBF.new(0.0, r1.get_data) -# print feature ranks -r2.print_feature_ranks +# number of features before feature selection +puts '# features (before): ' + r2.get_features.size.to_s + +# feature selection +r2.select_feature! + +# number of features after feature selection +puts '# features (after): ' + r2.get_features.size.to_s

    Copyright

    -

    FSelector © 2011-2012 by Tiejun Cheng. +

    FSelector © 2012 by Tiejun Cheng. FSelector is licensed under the MIT license. Please see the LICENSE for more information.

    diff --git a/doc/method_list.html b/doc/method_list.html index 63b384b..f81e50b 100644 --- a/doc/method_list.html +++ b/doc/method_list.html @@ -153,7 +153,7 @@

    Method List

  • - #discretize_chimerge! + #discretize_by_chimerge! Discretilizer @@ -161,7 +161,7 @@

    Method List

  • - #discretize_equal_frequency! + #discretize_by_equal_frequency! Discretilizer @@ -169,7 +169,7 @@

    Method List

  • - #discretize_equal_width! + #discretize_by_equal_width! Discretilizer @@ -225,7 +225,7 @@

    Method List

  • - #get_classes + #get_class_labels FSelector::Base @@ -233,7 +233,7 @@

    Method List

  • - #get_data + #get_classes FSelector::Base @@ -241,14 +241,22 @@

    Method List

  • - #get_feature_ranks + #get_conditional_entropy - FSelector::Ensemble + Entropy
  • + #get_data + + FSelector::Base + +
  • + + +
  • #get_feature_ranks FSelector::Base @@ -256,6 +264,14 @@

    Method List

  • +
  • + #get_feature_ranks + + FSelector::Ensemble + +
  • + +
  • #get_feature_scores @@ -297,23 +313,23 @@

    Method List

  • - #get_opt + #get_joint_entropy - FSelector::Base + Entropy
  • - #get_pdf + #get_marginal_entropy - Rubystats::NormalDistribution + Entropy
  • - #get_sample_size + #get_opt FSelector::Base @@ -321,25 +337,25 @@

    Method List

  • - #initialize + #get_pdf - FSelector::Base + Rubystats::NormalDistribution
  • - #initialize + #get_sample_size - Rubystats::NormalDistribution + FSelector::Base
  • - #initialize + #initialize - Rubystats::FishersExactTest + FSelector::BaseContinuous
  • @@ -353,33 +369,33 @@

    Method List

  • - #initialize + #initialize - FSelector::ReliefF_c + FSelector::ChiSquaredTest
  • - #initialize + #initialize - FSelector::Relief_c + FSelector::BaseRelief
  • - #initialize + #initialize - FSelector::ReliefF_d + Rubystats::FishersExactTest
  • - #initialize + #initialize - FSelector::Relief_d + FSelector::Base
  • @@ -393,9 +409,9 @@

    Method List

  • - #initialize + #initialize - FSelector::Ensemble + Rubystats::NormalDistribution
  • @@ -409,39 +425,39 @@

    Method List

  • - #initialize + #initialize - FSelector::BaseContinuous + FSelector::BaseReliefF
  • - #initialize + #initialize - FSelector::BaseDiscrete + FSelector::Ensemble
  • - #initialize + #initialize - FSelector::ChiSquaredTest + FSelector::BaseDiscrete
  • - #normalize_log! + #initialize - Normalizer + FSelector::FastCorrelationBasedFilter
  • - #normalize_min_max! + #normalize_log! Normalizer @@ -449,7 +465,7 @@

    Method List

  • - #normalize_zscore! + #normalize_min_max! Normalizer @@ -457,17 +473,17 @@

    Method List

  • - #print_feature_ranks + #normalize_zscore! - FSelector::Base + Normalizer
  • - #print_feature_scores + #pearson_r - FSelector::Base + Array
  • @@ -481,7 +497,7 @@

    Method List

  • - #select_data_by_rank! + #select_feature! FSelector::Base @@ -489,7 +505,7 @@

    Method List

  • - #select_data_by_score! + #select_feature_by_rank! FSelector::Base @@ -497,7 +513,7 @@

    Method List

  • - #set_classes + #select_feature_by_score! FSelector::Base @@ -505,7 +521,7 @@

    Method List

  • - #set_data + #set_classes FSelector::Base @@ -521,7 +537,7 @@

    Method List

  • - #set_feature_score + #set_data FSelector::Base diff --git a/doc/top-level-namespace.html b/doc/top-level-namespace.html index 446b34a..ea5dfbf 100644 --- a/doc/top-level-namespace.html +++ b/doc/top-level-namespace.html @@ -6,7 +6,7 @@ Top Level Namespace - — Documentation by YARD 0.7.5 + — FSelector Documentation @@ -78,7 +78,7 @@

    Defined Under Namespace

    - Modules: Discretilizer, FSelector, FileIO, Normalizer, Rubystats + Modules: Discretilizer, Entropy, FSelector, FileIO, Normalizer, Rubystats @@ -110,7 +110,7 @@

    Constant Summary