I saw notes in the assignment page stating that assignment was updated this morning(8/16/2021) removing some unnecessary codes and revising other codes. I resubmitted my assignment again this morning, instead of Cell#14 problem, I get a new message regarding :
Cell#12: Cant compile the student’s code. TypeError( unsupported operand types for “Nonetype” and “float”.
UNIT TEST
def model_test(target):
Create a controlled word to vec map
word_to_vec_map = {‘a’: [3, 3], ‘synonym_of_a’: [3, 3], ‘a_nw’: [2, 4], ‘a_s’: [3, 2], ‘a_n’: [3, 4],
‘c’: [-2, 1], ‘c_n’: [-2, 2],‘c_ne’: [-1, 2], ‘c_e’: [-1, 1], ‘c_se’: [-1, 0],
‘c_s’: [-2, 0], ‘c_sw’: [-3, 0], ‘c_w’: [-3, 1], ‘c_nw’: [-3, 2]
}
Convert lists to np.arrays
for key in word_to_vec_map.keys():
word_to_vec_map[key] = np.array(word_to_vec_map[key])
Training set. Sentences composed of a_* words will be of class 0 and sentences composed of c_* words will be of class 1
X = np.asarray([‘a a_s synonym_of_a a_n c_sw’, ‘a a_s a_n c_sw’, ‘a_s a a_n’, ‘synonym_of_a a a_s a_n c_sw’, " a_s a_n",
" a a_s a_n c “, " a_n a c c c_e”,
‘c c_nw c_n c c_ne’, ‘c_e c c_se c_s’, ‘c_nw c a_s c_e c_e’, ‘c_e a_nw c_sw’, ‘c_sw c c_ne c_ne’])
Y = np.asarray([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1])
np.random.seed(10)
pred, W, b = model(X, Y, word_to_vec_map, 0.0025, 110)
assert W.shape == (2, 2), “W must be of shape 2 x 2”
assert np.allclose(pred.transpose(), Y), “Model must give a perfect accuracy”
assert np.allclose(b[0], -1 * b[1]), “b should be symmetric in this example”
print("\033[92mAll tests passed!")
model_test(model)
I did not code this cell, it was already included in the assignment. Please suggest solution. Thanks