My code below always gets the right answer but, after confirming my answers are correct, the routine used by the course then throws a series of errors. Of course, I don’t have access to the course checking code so I can’t trouble shoot Here is my code:
def split_dataset(X, node_indices, feature):
Splits the data at the given node into
left and right branches
Args:
X (ndarray): Data matrix of shape(n_samples, n_features)
node_indices (list): List containing the active indices. I.e, the samples being considered at this step.
feature (int): Index of feature to split on
Returns:
left_indices (list): Indices with feature value == 1
right_indices (list): Indices with feature value == 0
"""
# You need to return the following variables correctly
left_indices = []
right_indices = []
### START CODE HERE ###
# {mentor edit: code removed}
### END CODE HERE ###
return left_indices, right_indices