Class | Ai4r::Classifiers::Hyperpipes |
In: |
lib/ai4r/classifiers/hyperpipes.rb
|
Parent: | Classifier |
A fast classifier algorithm, created by Lucio de Souza Coelho and Len Trigg.
data_set | [R] | |
pipes | [R] |
Build a new Hyperpipes classifier. You must provide a DataSet instance as parameter. The last attribute of each item is considered as the item class.
You can evaluate new data, predicting its class. e.g.
classifier.eval(['New York', '<30', 'F']) # => 'Y'
This method returns the generated rules in ruby code. e.g.
classifier.get_rules # => if age_range == '<30' then marketing_target = 'Y' elsif age_range == '[30-50)' then marketing_target = 'N' elsif age_range == '[50-80]' then marketing_target = 'N' end
It is a nice way to inspect induction results, and also to execute them:
marketing_target = nil eval classifier.get_rules puts marketing_target # => 'Y'