C1W2 ,Programming assignment error

Hello ! I get the following error in Runing ‘# GRADED FUNCTION: model’ , please help me to solve the problem,thanks!

def model(X_train, Y_train, X_test, Y_test, num_iterations=2000, learning_rate=0.5, print_cost=False):

# YOUR CODE STARTS HERE

# moderator edit: code removed

# YOUR CODE ENDS HERE

# Print train/test Errors
if print_cost:
    print("train accuracy: {} %".format(100 - np.mean(np.abs(Y_prediction_train - Y_train)) * 100))
    print("test accuracy: {} %".format(100 - np.mean(np.abs(Y_prediction_test - Y_test)) * 100))


d = {"costs": costs,
     "Y_prediction_test": Y_prediction_test, 
     "Y_prediction_train" : Y_prediction_train, 
     "w" : w, 
     "b" : b,
     "learning_rate" : learning_rate,
     "num_iterations": num_iterations}

return d

AssertionError Traceback (most recent call last)
in
1 from public_tests import *
2
----> 3 model_test(model)

~/work/release/W2A2/public_tests.py in model_test(target)
131 assert type(d[‘w’]) == np.ndarray, f"Wrong type for d[‘w’]. {type(d[‘w’])} != np.ndarray"
132 assert d[‘w’].shape == (X.shape[0], 1), f"Wrong shape for d[‘w’]. {d[‘w’].shape} != {(X.shape[0], 1)}"
→ 133 assert np.allclose(d[‘w’], expected_output[‘w’]), f"Wrong values for d[‘w’]. {d[‘w’]} != {expected_output[‘w’]}"
134
135 assert np.allclose(d[‘b’], expected_output[‘b’]), f"Wrong values for d[‘b’]. {d[‘b’]} != {expected_output[‘b’]}"

AssertionError: Wrong values for d[‘w’]. [[ 0.14449502]
[-0.1429235 ]
[-0.19867517]
[ 0.21265053]] != [[ 0.08639757]
[-0.08231268]
[-0.11798927]
[ 0.12866053]]

First, you have to call the initialize function for w and b. Second, do not hard code the num_iterations and learning_rate.

Third, please do not post your code on the forum. That is not allowed by the Code of Conduct.

Thank you so much! It can work now.

Saif Ur Rehman via DeepLearning.AI <notifications@dlai.discoursemail.com>于2023年10月1日 周日上午12:34写道:

Ok, Sir. Thank for your reminder.

Tom Mosher via DeepLearning.AI <notifications@dlai.discoursemail.com>于2023年10月1日 周日上午5:11写道: