Feature Selection

Feature Selection is a library of feature selection algorithms.

en.wikipedia.org/wiki/Feature_selection

Install

gem sources -a http://gems.github.com
sudo gem install feature_selection

How To Use

There are currently 3 implemented feature collections: Chi-Squared, Mutual Information and Frequency Based.

Each return a hash that looks similar to:

{klass => {term => score, term => score}, klass => {term => score}}

Example:

data = {
        :spam => [['this', 'is', 'some', 'information'], ['this', 'is', 'something', 'that', 'is', 'information']],
        :ham => [['this', 'test', 'some', 'more', 'information'], ['there', 'are', 'some', 'things']],
        }

a = FeatureSelection::ChiSquared.new(data)

# You can also use...
# FeatureSelection::MutualInformation
# FeatureSelection::FrequencyBased

a.rank_features
  #=> {:spam => {term => score, term => score}, :ham => {term => score}}

Copyright © 2009 reddavis. See LICENSE for details.