my 1st question is why is this value = -1 and not other values and how to choose what values to put, mainly how does -1 return the following variables correctly
2nd question is how does this line of code split the indices into X and y
3rd question is what do indices refer to, I have been moving on without understanding it
by far I find decision trees to be the most challenging if in any case, anyone has more tips or recommendations for videos do drop them here in the reply section!!! I would appreciate any help :3
It is by design that the algorithm has to return -1 when none of the splits gets us any gain. One of the public tests will send a y that has the same class label for all samples, and that is the case when we won’t update the best_feature variable to any other value but the default -1.
This is called unpacking in Python. It unpacks a list (or a tuple, or an iterable) of variables on the right hand side one-by-one to the variables on the left hand side. Please google “Python unpacking” for more examples.
The DocStringhas explained it. Please refer to the DocString. If you are not sure what a DocString is, you might start googling with “python DocString”.