Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Keras for text classification

I am struggling to approach the bag of words / vocabulary method for representing my input data as one hot vectors for my neural net model in keras.

I would like to build a simple 3 layer network but I need help in understanding and developing an approach to transform my labelled data in the form of text,sentinment which is has 7 labels, in the range of 0 - 1 in steps of 0.2.

I have tried to use scikit's vectorisers but they are too rigid i.e they either tokenise words or characters, whereas I need a sentence to be compared to the vocabulary which includes words, characters, punctuation and emojis. When i use tfid on a test sentence it only counts the words and ignores everything else. I also need guidance on taking this one hot approach and how it will be implemented in keras.

like image 903
Moey Zf Avatar asked Mar 11 '23 09:03

Moey Zf


1 Answers

Here is a Keras example where they have 8 output classes and use a bag of words.

like image 109
TFUser Avatar answered Mar 16 '23 09:03

TFUser