Jovian
Sign In

Rnn Twitter Seintment Analysis

RNN(Recurrent Neural Networks) for twitter-Seintment-Analysis

This notebook covers

  • one hot encoding mechanism (used to vectorize text and catagorical data from kaggle)

  • Plain RNN implementation and trainning using data from kaggle

  • Plain LSTM(Long Term short Term Memory Recurrent Unit) implementation and trainning using data from kaggle

Hence, there are 2 models that are trainned using the same twiiter seintment data

!pip install -Uq opendatasets
%%time
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import random_split,DataLoader,TensorDataset
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import pandas as pd
import os
from tqdm.notebook import tqdm
from copy import deepcopy
import opendatasets as od
from math import floor
CPU times: user 970 ms, sys: 388 ms, total: 1.36 s Wall time: 1.28 s

Data utilized can be found from Kaggle

the link:

Twitter Sentiment Analysis Dataset

od.download("https://www.kaggle.com/jp797498e/twitter-entity-sentiment-analysis?select=twitter_training.csv")
od.download("https://www.kaggle.com/jp797498e/twitter-entity-sentiment-analysis?select=twitter_validation.csv")
Skipping, found downloaded files in "./twitter-entity-sentiment-analysis" (use force=True to force download) Skipping, found downloaded files in "./twitter-entity-sentiment-analysis" (use force=True to force download)