examples/decision_trees/id3_example.rb in ai4r-1.1 vs examples/decision_trees/id3_example.rb in ai4r-1.2
- old
+ new
@@ -5,21 +5,22 @@
#
# You can redistribute it and/or modify it under the terms of
# the Mozilla Public License version 1.1 as published by the
# Mozilla Foundation at http://www.mozilla.org/MPL/MPL-1.1.txt
-require File.dirname(__FILE__) + '/../../lib/decision_tree/id3'
+#require File.dirname(__FILE__) + '/../../lib/decision_tree/id3'
+require File.dirname(__FILE__) + '/../../lib/ai4r/classifiers/id3'
require 'csv'
# Load data from data_set.csv
data_set = []
CSV::Reader.parse(File.open("#{File.dirname(__FILE__)}/data_set.csv", 'r')) do |row|
data_set << row
end
data_labels = data_set.shift
# Build ID3 tree
-id3 = DecisionTree::ID3.new(data_set, data_labels)
+id3 = Ai4r::Classifiers::ID3.new.build(data_set, data_labels)
# Show rules
puts "Discovered rules are:"
puts id3.to_s