Emile Santino
Emile Santino

Reputation: 21

TensorFlow keras Text classification: Applying model to score a word

The data i am using is BBC News Paper headlines , with its genre description category. ( Sport , Business, Politics, Tech , Entertainment ).

I am having trouble with interpreting the output after training the model and doing an assessment of the loss. I want to say which category out of the 5 ( Sport , Business, Politics, Tech , Entertainment ) the model would score a new sentence i give the model.

I know the model final layer outputs 5 categories+ 1 for no result : resulttf.keras.layers.Dense(6, activation='softmax') .

Below is my attempt, I get the tokens. the predictions class are all 1 and the model predict gives me a matrix of (Number of letters in my test sentence x the number of classification categories)

for many examples i get this '1 1 1 1 1' answer which even when i try different category of words.

enter image description here

Upvotes: 0

Views: 185

Answers (1)

Emile Santino
Emile Santino

Reputation: 21

I managed to find the solution to the issue by changing how i input a new sentence. The key was to add it in this format.

sentence = ["""Olympic games"""]

I then get one key reflecting one word and a score classification per sentence/paragraph.

Upvotes: 1

Related Questions