Feature and Labels

Can you help me to solved this? i spent my time 5 hours but stilll fail. This is urgent.Thank you


Maybe a way forward would be to display the shape and content of input_sequences then compare that to what you are slicing into features. Any chance you’re off-by-one on the slicing index?

can you describe with the code?

The expected shape of features has 5 rows and 4 columns. Your shape of features has 5 rows and 3 columns. Where in your code is the number of columns being determined? How could that end up one less than expected?

I am facing the same issue but only in the features shape

You could add some diagnostic prints to features_and_labels() like this

    print('input_sequences type: ' + str(type(input_sequences)))
    print('input_sequences shape: ' + str(input_sequences.shape))

    print('features shape: ' + str(features.shape))
    print('labels shape: ' + str(labels.shape))

which should generate output like this…

input_sequences type: <class 'numpy.ndarray'>
input_sequences shape: (15462, 11)
features shape: (15462, 10)
labels shape: (15462,)
features have shape: (15462, 10)
labels have shape: (15462, 3211)

if your dimensions are wrong, then you need to fix the slicing rule that extracts features and labels from input_sequences. Basically, you need one rule that slices out all except the last and another that slices out only the last. There is a specific Python idiom for doing this.

1 Like

thank you solved the issue, my features code was incorrect.

1 Like