In exercise 8, when we have to use the functions previously coded, I am getting an assertion error for the value of “w”. I don’t know how to solve the issue because I don’t see anything wrong.
AssertionError: Wrong values for d[‘w’]. [[ 0.14449502]
[-0.1429235 ]
[-0.19867517]
[ 0.21265053]] != [[ 0.08639757]
[-0.08231268]
[-0.11798927]
[ 0.12866053]
I don’t know why the expected “w” values should contain only one value. The X_train shape is (4, 7) (apparently) so my code is printing 7 “w” values, which seems right to me, or I am missing something here.
I think you are misinterpreting the output there: the two w values being compared are both 4 x 1 column vectors. Well, there must be something incorrect about the way you are calling the previous functions that you wrote, meaning that the logic in model
must be incorrect. One common type of mistake is to “hard-code” or omit the optional parameters when you call optimize
from model
. Make sure that you are passing through the given values of learning rate and number of iterations that were passed into the top level of the model
function.
Also note that there are several test cases used by the test cell for model
and not all of them have the same number of features. But note that in a case where X is 4 x 7, then w should have 4 elements, not 7, right?
1 Like
The error was I was not passing through all the given values at the top of the model function.
Thank you so much for your help!