It's nice being able to trivially parallelise operations in Go - e.g. constructing the weak learners for a random forest, generating candidate splits, recursing down left and right branches, etc.
// Recur down the left and right branches in parallel
w := sync.WaitGroup{}
recur := func(child **pb.TreeNode, e Examples) {
w.Add(1)
go func() {
*child = c.generateTree(e, currentLevel+1)
w.Done()
}()
}
recur(&tree.Left, examples[bestSplit.index:])
recur(&tree.Right, examples[:bestSplit.index])
w.Wait()
As you said, generics and a matrix library would be make the experience nicer. Just having
sort :: Ord a => [a] -> [a]
would strip a decent amount of mildly error-prone boilerplate, and there are other cases (splits for cross-validation, etc) where it would be nice to be able to abstract over the type of the slice, etc.
It's nice being able to trivially parallelise operations in Go - e.g. constructing the weak learners for a random forest, generating candidate splits, recursing down left and right branches, etc.
As you said, generics and a matrix library would be make the experience nicer. Just having would strip a decent amount of mildly error-prone boilerplate, and there are other cases (splits for cross-validation, etc) where it would be nice to be able to abstract over the type of the slice, etc.