BBC News archive error on model fit

Hi, I have encountered this error while fitting my model.

ValueError: Failed to find data adapter that can handle input: <class ‘numpy.ndarray’>, (<class ‘list’> containing values of types {’(<class ‘list’> containing values of types {"<class ‘int’>"})’})

Exercise_2_BBC_news_archive_Question-FINAL.ipynb (26.9 KB)

Hi @pyaj,
it’s difficult to understand what’s the problem. Can you send your python file?

Alright. should I copy all my codes here ?

You should send it as attachment

On this platform? How to do that?

When you reply, search for this symbol and attach:

Screenshot 2021-11-01 at 15.21.21

Alright I have just uploaded the notebook

I still cannot see it

It’s in the initial question, at the top

In the last layer, the activation function you’re using is a sigmoid. But here you’re choosing between 6 units, not between 2. Change the activation accordingly and it should work.


I chose 2 instead of 6 dense units and I still get the same error. The exercise also recommends that we use 6 units of dense layer

You should change the activation function, not the number of units. Sigmoid is not the right one.

Oh I just checked again, it also shows the same error with the softmax activation

Sorry, I noticed just now: you should also change your target in the, where I see
train_labels (wrong)

PS: you should find an array that has values between 0 and 5

1 Like

I should have added the training_label_seq

@maurizioscibilia I am unfortunately back again. Please check this issue with me.

It seems like your sentences variable doesn’t show the text it was showing before. Can you send me the screenshot of what appears now, after you execute: sentences[0]

in cell [4] I can see that you have:
sentence = sentence.replace(" ", " ")
Try to remove it

1 Like

It’s good now! Please check 3rd assignment’s question on this link