This device is not compatible.


Sarcasm Classification Using BERT

In this project, we'll learn how to retrieve the pretrained BERT model from TensorFlow Hub and fine-tune it to classify sarcastic tweets.

Sarcasm Classification Using BERT

You will learn to:

Load and preprocess the Multi-modal Sarcasm Detection Dataset.

Use the TensorFlow Hub to download the pretrained BERT model and its preprocessor.

Create and train a classification model with BERT embeddings.

Evaluate the model using the scikit-learn library.


Natural Language Processing

Deep Learning

Transformer Models


Basic programming skills in Python

Intermediate working knowledge of Keras

Intermediate knowledge of deep learning theory

Basic knowledge of Matplotlib, NumPy, and pandas


keras logo






Project Description

Google released the Bidirectional Encoder Representations from Transformers (BERT) model in 2018. It consists of stacked encoders of the transformer model released in 2017 and is pretrained on masked language modeling and next-sentence prediction tasks. It has seen massive success in modeling linguistic and semantic features in NLP applications. As a result, BERT has been successfully used for question answering, multigenre classification of text, and sentence completion tasks.

In this project, we'll fine-tune the BERT model to detect sarcastic tweets. To do this, we'll use pandas and NumPy for manipulating the dataset. We'll also use the seaborn and Matplotlib libraries for creating visualizations and Keras and TensorFlow for implementing deep learning. Finally, we'll use the scikit-learn library to evaluate the model and compute its classification report.

Project Tasks


Getting Started

Task 0: Introduction

Task 1: Import Libraries

Task 2: Load the Dataset


Set Up Training Environment

Task 3: Preprocess the Data

Task 4: Choose the Model and its Preprocessor

Task 5: Create the Classification Model


Model Training

Task 6: Initialize the Parameters

Task 7: Load the Trained Model

Task 8: Train the Model

Task 9: Display the Training Curve


Model Evaluation

Task 10: Evaluate the Model

Task 11: Create a Confusion Matrix

Task 12: Generate the Classification Report