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
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.
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