Moved to numpy vector operations in tree-based calculation