How can I go multi text classification in tensorflow, can someone help. I have a dataset of airline, Where user complaint about flight delay, or baggage lost or baggage delay, so while reading comments I need to tag comments. Like if its flight delay ‘FD’, Baggage Lost tag could be ‘BL’ and Baggage Delay is ‘BD’.
Comments could be,
My baggage is damaged, Flight not take off on time, I lost my baggage, My suitcase is lot.
Hi @waqas80, To perform a multi class text classification problem, first you have to convert the text to integers using the text vectorization layer. Also convert your labels to integers using one hot encoding. Then define the embedding model. for example
model = tf.keras.Sequential([
layers.Embedding(10000, 16),
layers.Dropout(0.2),
layers.GlobalAveragePooling1D(),
layers.Dropout(0.2),
layers.Dense(3, activation='softmax')])
The number of neurons in the last layer depends upon the number of the class and for multi class classification the activation should be sigmoid. Thank You.
Thanks @Kiran_Sai_Ramineni , I will work on it and create a code and share as well. If you have some sample code please share. I have 22 labels. And these are the top used labels I get from business, else there are 560 labels.
One question @Kiran_Sai_Ramineni, you said to convert text into integers, so did you mean I have to converts comments and labels both in integers?
Hi @waqas80, yes, you have to convert comments into tokens using any tokenizer and labels to integers using one-hot encoding. Thank You.