I’m getting an error upon running create_training_example_test(target) in the Trigger WOrd Detection assignment. The error is as shown below. I checked my codes and all seems fine.
I might had accidently deleted or edited some codes. Is it possible to reload a fresh version of this assignment without any saved input codes from me? Please help.
AssertionError Traceback (most recent call last)
in
17 print(“\033[92m All tests passed!”)
18
—> 19 create_training_example_test(create_training_example)
in create_training_example_test(target)
13 assert np.sum(y) >= 50, “It must contain at least one activate”
14 assert np.sum(y) % 50 == 0, “Sum of activate marks must be a multiple of 50”
—> 15 assert np.isclose(np.linalg.norm(x), 39745552.52075), “Spectrogram is wrong. Check the parameters passed to the insert_audio_clip function”
16
17 print(“\033[92m All tests passed!”)
AssertionError: Spectrogram is wrong. Check the parameters passed to the insert_audio_clip function
And here is my insert_audio_clip,
(Solution code removed, as posting it publicly is against the honour code of this community, regardless if it is correct or not)
And,
UNIT TEST
def create_training_example_test(target):
np.random.seed(18)
x, y = target(backgrounds[0], activates, negatives, 1375)
assert type(x) == np.ndarray, "Wrong type for x"
assert type(y) == np.ndarray, "Wrong type for y"
assert tuple(x.shape) == (101, 5511), "Wrong shape for x"
assert tuple(y.shape) == (1, 1375), "Wrong shape for y"
assert np.all(x > 0), "All x values must be higher than 0"
assert np.all(y >= 0), "All y values must be higher or equal than 0"
assert np.all(y <= 1), "All y values must be smaller or equal than 1"
assert np.sum(y) >= 50, "It must contain at least one activate"
assert np.sum(y) % 50 == 0, "Sum of activate marks must be a multiple of 50"
assert np.isclose(np.linalg.norm(x), 39745552.52075), "Spectrogram is wrong. Check the parameters passed to the insert_audio_clip function"
print("\033[92m All tests passed!")
create_training_example_test(create_training_example)