I want to extract the subtree from the RegressionTree resulting from
training the associated model based on inputs: rootNode and depth,
Here's my buggy code (that I want it to be checked for errors)
def extract_tree_depth_first_traversal(tree, root_start, t_depth):
depth = 1
sub_tree = []
Hi Marc,
a first observation: stack.get(0) returns but does NOT remove the first
element from a list (even if you name it stack). If you want a stack, you
need to use the pop method.
See also here:
https://docs.python.org/3/tutorial/datastructures.html#using-lists-as-stacks
Best regards
Christ