Skip to content

Instantly share code, notes, and snippets.

@ajtulloch
Created November 3, 2013 17:51
Show Gist options
  • Save ajtulloch/7292836 to your computer and use it in GitHub Desktop.
Save ajtulloch/7292836 to your computer and use it in GitHub Desktop.
func (r *randomForestGenerator) ConstructForest(e Examples) *pb.Forest {
result := &pb.Forest{
Trees: make([]*pb.TreeNode, int(r.forestConfig.GetNumWeakLearners())),
Rescaling: pb.Rescaling_AVERAGING.Enum(),
}
wg := sync.WaitGroup{}
for i := 0; i < int(r.forestConfig.GetNumWeakLearners()); i++ {
wg.Add(1)
go func(i int) {
result.Trees[i] = r.constructRandomTree(e)
wg.Done()
}(i)
}
wg.Wait()
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment