Why does the value best_feature = -1 in the last exercise of week 4? When I set it to zero, it does not work
Hi! Can you share the error message that indicates that it does not work?
Thanks for the screenshot. It is exactly as the Error message says, you need to return -1 as the best feature when the targets are all the same value, or equivalently saying, you need to return -1 when no feature will give us any information gain. Please consider this as a requirement.
To understand why setting that variable as -1 will give us the desired result, you need to read the code, then think about if we set it to 0, how can it return a -1 as desired?
Oh now i get it. Thank you for the explanation
You’re welcome @iliasu_Sal!