> > class EmptyDecisionTreeOfEmptyDecisionTrees:
> > def __init__(self, min_children, max_children):
> > nch = random.randint(min_children, max_children)
> > self.children = [EmptyDecisionTree(min_children//2,max_children//2) for
> > chidx in range(nch)]
> > def perform_work(self):
> > print("all of my subparts are empty i will skip thinking about them
> > right now")
> > def get_score(self):
> > print("i am an empty decision tree i can't have a score")
> > this seems somewhat reasonable! let's make the workers who cannot
> > accomplish anything do some work!
> > traffick boss wander his area
> he is thinking ... of nothing
> he also imagines all his thoughts about nothing as having subparts, each one
> containing nothing, in depth!
class EmptyDecisionTreeOfEmptyDecisionTrees:
def __init__(self, min_children, max_children, data):
assert data == "nothing"
nch = random.randint(min_children, max_children)
self.children = [EmptyDecisionTree(min_children//2,max_children//2) for
chidx in range(nch)]
self.data = data
def verify_empty(self):
assert self.data == "nothing"
for child in self.children:
assert child.verify_empty() == "i contain nothing"
return "i contain nothing"
def perform_work(self):
assert self.verify_empty() == "i contain nothing"
print("all of my subparts are empty i will skip thinking about them right
now")
def get_score(self):
assert self.verify_empty() == "i contain nothing"
print("i am an empty decision tree i can't have a score")