Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,58 @@
|
|
| 1 |
---
|
| 2 |
license: openrail
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: openrail
|
| 3 |
---
|
| 4 |
+
\documentclass{article}
|
| 5 |
+
\usepackage{hyperref}
|
| 6 |
+
|
| 7 |
+
\title{Amazon Fine Food Sentiment Analysis with BERT}
|
| 8 |
+
\author{Vivek Kumar Trivedi}
|
| 9 |
+
\date{\today}
|
| 10 |
+
|
| 11 |
+
\begin{document}
|
| 12 |
+
\maketitle
|
| 13 |
+
|
| 14 |
+
\section{About the Model}
|
| 15 |
+
This repository contains code for a sentiment analysis that predicts the sentiment of Amazon fine food reviews using a finetuned BERT Base model from the Hugging Face Transformers library. The model also includes an interface built using Gradio, allowing users to interactively input reviews and receive sentiment predictions.
|
| 16 |
+
|
| 17 |
+
\section{Amazon Fine Food Reviews Dataset}
|
| 18 |
+
The sentiment analysis model is trained on the Amazon Fine Food Reviews dataset with the following details:
|
| 19 |
+
\begin{itemize}
|
| 20 |
+
\item Number of reviews: 568,454
|
| 21 |
+
\item Number of users: 256,059
|
| 22 |
+
\item Number of products: 74,258
|
| 23 |
+
\item Timespan: October 1999 — October 2012
|
| 24 |
+
\item Number of attributes/columns in the data: 10
|
| 25 |
+
\end{itemize}
|
| 26 |
+
|
| 27 |
+
\section{Model Architecture}
|
| 28 |
+
In the training procedure, the forward pass of the sentiment analysis model is structured as follows:
|
| 29 |
+
\begin{verbatim}
|
| 30 |
+
self.bert = BertModel.from_pretrained(MODEL_NAME)
|
| 31 |
+
self.drop = nn.Dropout(p=0.3)
|
| 32 |
+
self.out = nn.Linear(self.bert.config.hidden_size, n_classes)
|
| 33 |
+
\end{verbatim}
|
| 34 |
+
|
| 35 |
+
\section{Files in the Repository}
|
| 36 |
+
\begin{itemize}
|
| 37 |
+
\item \texttt{amazon\_finefood\_sentiment\_analysis\_training.ipynb}: This Jupyter Notebook contains the code for training the sentiment analysis model on the Amazon Fine Food Reviews dataset.
|
| 38 |
+
\item \texttt{amazon\_finefood\_sentiment\_analysis\_interface.ipynb}: This Jupyter Notebook includes the code for building the Gradio interface that utilizes the trained model for sentiment prediction.
|
| 39 |
+
\item \texttt{sentiment\_analysis\_finetune\_bert.pkl}: This pickled file stores the trained sentiment analysis model in a serialized format.
|
| 40 |
+
\end{itemize}
|
| 41 |
+
|
| 42 |
+
\section{Usage}
|
| 43 |
+
To run the code and interact with the sentiment analysis demo:
|
| 44 |
+
\begin{enumerate}
|
| 45 |
+
\item Open the \texttt{amazon\_finefood\_sentiment\_analysis\_interface.ipynb} notebook.
|
| 46 |
+
\item Set the file path to the \texttt{sentiment\_analysis\_finetune\_bert.pkl} file, which contains the trained model.
|
| 47 |
+
\item Execute the notebook cells to set up the Gradio interface and make predictions on Amazon fine food reviews.
|
| 48 |
+
\end{enumerate}
|
| 49 |
+
|
| 50 |
+
Feel free to experiment with the interface, input different reviews, and observe the model's sentiment predictions and confidence scores.
|
| 51 |
+
|
| 52 |
+
For any questions or issues, please feel free to open an issue in this repository.
|
| 53 |
+
|
| 54 |
+
\section{Acknowledgments}
|
| 55 |
+
The sentiment analysis model is based on the BERT architecture developed by Google and made available through the Hugging Face Transformers library. The Amazon Fine Food Reviews dataset is used for training and evaluating the model's performance. Gradio is used to create the interactive user interface for sentiment prediction.
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
\end{document}
|