Class: HybridForest::Forests::ForestGrowers::ID3Grower

Inherits:
Object
  • Object
show all
Defined in:
lib/hybridforest/forests/forest_growers/id3_grower.rb

Instance Method Summary collapse

Instance Method Details

#grow_forest(instances, number_of_trees) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/hybridforest/forests/forest_growers/id3_grower.rb', line 8

def grow_forest(instances, number_of_trees)
  forest = []
  number_of_trees.times do
    sample = HybridForest::Utils.random_sample(data: instances, size: instances.size)
    forest << HybridForest::Trees::ID3Tree.new.fit(sample)
  end
  forest
end