Error on C3M4

I’m getting two errors on my assignment but I don’t know what’s wrong. In case it’s useful, here’s the labID thjctolucfwe

Error: Failed test case: There was a problem trying to get predictions from your model. For more information, this was the returned error: shapes (4529,1) and (2,) not aligned: 1 (dim 1) != 2 (dim 0).

Exercise 5:

Error: Failed test case: The variable numeric_features has incorrect type (should be a list).

In this exercise, it’s even stranger because i see that the result that I’m getting is the same as the expected one

Hi @0xJavy, welcome to the forum! :blush:

I just checked this lab, and here are the tips I have for you:

  • Please only replace the None parts and keep the exact variable names the notebook asks for. When the grader runs, it looks for specific variables with specific types. If you “shorten” or rename things (as it looks like you did, from the snippets above), your printed output can look right, but the grader won’t be able to find the expected objects.
  • In Exercise 4, the grader expects X_simple itself to already include the constant and to be the matrix used to fit the model. If you create a different variable (e.g., X) with the constant and fit with that, the grader later calls results_simple.predict(X_simple) and shapes won’t match (2 params vs 1 column) → the alignment error you saw.
  • In Exercise 5, the grader expects predictors (or numeric_features, depending on the cell) to be a Python list of column names, not a DataFrame. If you set predictors = df[[...]], its type is wrong even if the preview looks the same.

At this point, it’s probably easier for you to reset your notebook. You can refer to the instructions here, under Coursera Jupyter Lab Environment.

Good luck!

1 Like

Also please note that sharing code here is against the Code of Conduct. In the future, you can explain the issue of have and the feedback from the grader, so we will be able to help you :wink:

thanks a lot for the detailed explanation imgabidotcom

I won’t share again the code on the forum and i just deleted the one i shared just in case :slight_smile:

1 Like