Description

Descriptions

Ref: https://www.kaggle.com/madz2000/sentiment-analysis-cleaning-eda-bert-88-acc

BERT WORKING BERT relies on a Transformer (the attention mechanism that learns contextual relationships between words in a text). A basic Transformer consists of an encoder to read the text input and a decoder to produce a prediction for the task. Since BERT’s goal is to generate a language representation model, it only needs the encoder part. The input to the encoder for BERT is a sequence of tokens, which are first converted into vectors and then processed in the neural network. But before processing can start, BERT needs the input to be massaged and decorated with some extra metadata:

  1. Token embeddings: A [CLS] token is added to the input word tokens at the beginning of the first sentence and a [SEP] token is inserted at the end of each sentence.

  2. Segment embeddings: A marker indicating Sentence A or Sentence B is added to each token. This allows the encoder to distinguish between sentences.

  3. Positional embeddings: A positional embedding is added to each token to indicate its position in the sentence.

Ref: https://towardsml.com/2019/09/17/bert-explained-a-complete-guide-with-theory-and-tutorial/

Load the Libraries

Load the dataset

Text Data Processing

Train Test Split

Tokenizing

Model Evaluation