Machine Learning Beginner

Hi,

This is Anjum and I am currently going through the course Machine Learning for beginners. I am currently at the decision tree chapter and I am facing difficulty in completing my lab work. I tried doing multiple attempts. However, I keep getting the assertion error, I tried multiple times to solve for the error but could not figure it out.

Error: “If the target is fully correlated with other feature, that feature must be the best split. Expected 0, got 1”.

Can some one provide me with some guidance on solving this.

Thanks

Hi. Please double check the name of the course you’re taking. You can post the Coursera link here. I think we need to move this topic. Thanks.

Please see the link below. I have tried to check the code multiple times and seems to be corrected but I dont get the correct output.

Hi. Please create a new topic in this category instead. That is the correct course and the right set of Mentors will see your post. Please clearly state the week number, lab name, and exercise number (where you got that error) when discussing your issue so they will know what item you’re referring to. Thank you.

Hi , I am having trouble in course 2 , week 4 , Practice lab Decision tree Programming Assignment .

At the end of the assignment I am getting this error

 Depth 0, Root: Split on feature: 2
- Depth 1, Left: Split on feature: -1
  -- Left leaf node with indices [0, 1, 4, 5, 7]
  -- Right leaf node with indices []
- Depth 1, Right: Split on feature: -1
  -- Left leaf node with indices []
  -- Right leaf node with indices [2, 3, 6, 8, 9]

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-37-a0c8eafbc9f8> in <module>
      1 build_tree_recursive(X_train, y_train, root_indices, "Root", max_depth=2, current_depth=0)
----> 2 generate_tree_viz(root_indices, y_train, tree)

~/work/utils.py in generate_tree_viz(root_indices, y, tree)
     81         indices_list = level[:2]
     82         for indices in indices_list:
---> 83             G.add_node(idx,image= generate_node_image(indices))
     84             G.add_edge(root, idx)
     85 

~/work/utils.py in generate_node_image(node_indices)
      7     image_paths = ["images/%d.png" % idx for idx in node_indices]
      8     images = [Image.open(x) for x in image_paths]
----> 9     widths, heights = zip(*(i.size for i in images))
     10 
     11     total_width = sum(widths)

ValueError: not enough values to unpack (expected 2, got 0)

Please help as soon as. possible as I am stuck here from 2 days 

I am not able to do exercise 4 , in week 4 course 2

Exercise 4

Please complete the get_best_split() function shown below.

  • The function takes in the training data, along with the indices of datapoint at that node

  • The output of the function is the feature that gives the maximum information gain

    • You can use the compute_information_gain() function to iterate through the features and calculate the information for each feature If you get stuck, you can check out the hints presented after the cell below to help you with the implementation.

    • I have checked the hints , the code is correct , I am not able to recognize what is the issue

Hi. As mentioned, please post in fhis other category instead Advanced Learning Algorithms - DeepLearning.AI . That is the correct course.

@Anjum_90, you’re posting in the wrong forum area.
This thread is for an entirely different course.