mogr18
mogr18

Reputation: 29

Is there a dictionary for labels in keras.reuters.datasets?

I have recently started coding neural networks with keras. I managed to get an AI running that predicts the classes of the reuters newswire dataset. However, I am desperately looking for a way to convert my predictions (intgers) to topics. There has to be a dictionary -like the reuters.get_word_index for the training data- that has 46 entries and links each integer to its topic (string). Thanks for your help.

Upvotes: 1

Views: 1507

Answers (2)

Sakshi Udeshi
Sakshi Udeshi

Reputation: 21

['cocoa','grain','veg-oil','earn','acq','wheat','copper','housing','money-supply',
'coffee','sugar','trade','reserves','ship','cotton','carcass','crude','nat-gas',
'cpi','money-fx','interest','gnp','meal-feed','alum','oilseed','gold','tin',
'strategic-metal','livestock','retail','ipi','iron-steel','rubber','heat','jobs',
'lei','bop','zinc','orange','pet-chem','dlr','gas','silver','wpi','hog','lead']

Seem to be the labels as seen here

Upvotes: 2

Bulat Maksudov
Bulat Maksudov

Reputation: 51

Unfortunately it seems that Keras dataset lacks information about topics. You could use nltk version of the same dataset. You can get topic names there too. Refer to https://martin-thoma.com/nlp-reuters/ for details.

Upvotes: 5

Related Questions