mirror of
https://github.com/dkam/decisiontree.git
synced 2025-12-28 15:14:52 +00:00
Merge branch 'dvisockas-master'
This commit is contained in:
@@ -6,6 +6,8 @@ include DecisionTree
|
||||
|
||||
# Read in the training data
|
||||
training = []
|
||||
attributes = nil
|
||||
|
||||
File.open('data/continuous-training.txt', 'r').each_line do |line|
|
||||
data = line.strip.chomp('.').split(',')
|
||||
attributes ||= data
|
||||
|
||||
@@ -5,6 +5,8 @@ require 'decisiontree'
|
||||
|
||||
# Read in the training data
|
||||
training = []
|
||||
attributes = nil
|
||||
|
||||
File.open('data/discrete-training.txt', 'r').each_line do |line|
|
||||
data = line.strip.split(',')
|
||||
attributes ||= data
|
||||
@@ -45,7 +47,7 @@ File.open('data/discrete-test.txt', 'r').each_line do |line|
|
||||
v
|
||||
end
|
||||
end
|
||||
training.push(test_data)
|
||||
test.push(test_data)
|
||||
end
|
||||
|
||||
# Let the tree predict the output and compare it to the true specified value
|
||||
|
||||
@@ -190,7 +190,7 @@ module DecisionTree
|
||||
end
|
||||
label_text = "#{key} ''"
|
||||
if type(attr[0].attribute) == :continuous
|
||||
label_text.gsub!("''", attr[0].threshold)
|
||||
label_text.gsub!("''", attr[0].threshold.to_s)
|
||||
end
|
||||
|
||||
[parent_text, child_text, label_text]
|
||||
|
||||
Reference in New Issue
Block a user