spacy multi label classification help

I would like to create a multilabel text classification algorithm using SpaCy text multi label. I am unable to understand the following questions:

  1. How to convert the training data to SpaCy format i.e I have 8 categories
  2. After converting, how do we use that to train custom categories and apply different models

Topic spacy multiclass-classification deep-learning nlp

Category Data Science


Bro. It's waste to do classification using spaCy, you can refer Deep learning techniques. But your question is different, spaCy needs dictionary format with labels Positive and negative, Here I will give sample snippet, like this frame your input data

# change input data to spaCy readable format 

train_examples = [] # it needs dict inside tuples insides dictionary (you will understand down)

for index, row in reviews_df.iterrows(): text = row['Text'] rating = row['Score']

label = {"POS": True, "NEG": False} if rating == 1 else {'NEG':True, 'POS': False}

train_examples.append( Example.from_dict(nlp.make_doc(text), {'cats': label}) )

You can refer this https://www.machinelearningplus.com/nlp/custom-text-classification-spacy/ Clearly explained, Use Bert dude, BERT is SOTA model, that gives more accurate results, See here https://analyticsindiamag.com/a-beginners-guide-to-text-classification-using-bert-features/#:~:text=what%20BERT%20is.-,What%20is%20BERT%3F,both%20left%20and%20right%20context.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.