W3A1 wrong prediction result

Have all tests passed in notebook but prediction results is weird.
Result of this code snipet

EXAMPLES = ['3 May 1979', '5 April 09', '21th of August 2016', 'Tue 10 Jul 2007', 'Saturday May 9 2018', 'March 3 2001', 'March 3rd 2001', '1 March 2001']
s00 = np.zeros((1, n_s))
c00 = np.zeros((1, n_s))
for example in EXAMPLES:
    source = string_to_int(example, Tx, human_vocab)
    source = np.array(list(map(lambda x: to_categorical(x, num_classes=len(human_vocab)), source))).swapaxes(0,1)
    source = np.swapaxes(source, 0, 1)
    source = np.expand_dims(source, axis=0)
    prediction = model.predict([source, s00, c00])
    prediction = np.argmax(prediction, axis = -1)
    output = [inv_machine_vocab[int(i)] for i in prediction]
    print("source:", example)
    print("output:", ''.join(output),"\n")

Is the followiing:

source: 3 May 1979
output: 1111111111

source: 5 April 09
output: 2222222222

source: 21th of August 2016
output: 2222222222

source: Tue 10 Jul 2007
output: 2222222222

source: Saturday May 9 2018
output: 2222222222

source: March 3 2001
output: 2222222222

source: March 3rd 2001
output: 2222222222

source: 1 March 2001
output: 2222222222

Hi @arpo ,

Welcome to the community! It seems this is the first time you post here :slight_smile:

Regarding your case: It is definitively weird. Without having looked at your modelf definition (# UNQ_C2), I’d like to suggest as a first step to re-run all your cells and see if this helps.

To do that, please click in the “Cell” option in the main menu and then select “Run All” from the sub-menu. Lets see if that helps.

I look forward for your feedback,


Sure, thats what I first did re run all cells.
Here is modelf function:

(moderator edit: code removed)

Check out the parameters you are passing , S0, c0…. As the loop iterates, these will remain constant, which is not correct.

indeed, that helped. Thx

@arpo, I am glad it worked.

IMPORTANT: Please delete your code - posting code is not in the Code of Honor of the community.

Thank you!