Update README.md
Browse files
README.md
CHANGED
@@ -1,58 +1,44 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
For
|
53 |
|
54 |
-
|
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}
|
|
|
1 |
+
# Amazon Fine Food Sentiment Analysis with BERT
|
2 |
+
|
3 |
+
This repository contains code for a sentiment analysis demo that predicts the sentiment of Amazon fine food reviews using a finetuned BERT Base model from the Hugging Face Transformers library. The demo also includes an interface built using Gradio, allowing users to interactively input reviews and receive sentiment predictions.
|
4 |
+
|
5 |
+
## About the Demo
|
6 |
+
|
7 |
+
The sentiment analysis model is trained on the Amazon Fine Food Reviews dataset, which includes:
|
8 |
+
|
9 |
+
- Number of reviews: 568,454
|
10 |
+
- Number of users: 256,059
|
11 |
+
- Number of products: 74,258
|
12 |
+
- Timespan: Oct 1999 — Oct 2012
|
13 |
+
- Number of Attributes/Columns in data: 10
|
14 |
+
|
15 |
+
## Model Architecture
|
16 |
+
|
17 |
+
**Model Architecture:**
|
18 |
+
|
19 |
+
- `self.bert`: BERT Base model loaded from pre-trained weights.
|
20 |
+
- `self.drop`: Dropout layer applied for regularization.
|
21 |
+
- `self.out`: Linear layer mapping BERT hidden size to sentiment classes.
|
22 |
+
|
23 |
+
**Files in the Repository:**
|
24 |
+
|
25 |
+
- `amazon_finefood_sentiment_analysis_training.ipynb`: Code for training the sentiment analysis model.
|
26 |
+
- `amazon_finefood_sentiment_analysis_interface.ipynb`: Code for building the Gradio interface.
|
27 |
+
- `sentiment_analysis_finetune_bert.pkl`: Trained sentiment analysis model in serialized format.
|
28 |
+
|
29 |
+
**Usage:**
|
30 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
To run the code and interact with the sentiment analysis demo:
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
1. Open `amazon_finefood_sentiment_analysis_interface.ipynb`.
|
34 |
+
2. Set the file path to `sentiment_analysis_finetune_bert.pkl`.
|
35 |
+
3. Execute the notebook cells to set up the Gradio interface and make predictions.
|
36 |
+
|
37 |
+
Feel free to experiment with the interface, input different reviews, and observe sentiment predictions and confidence scores.
|
38 |
|
39 |
+
For questions/issues, open an issue in this repository.
|
40 |
|
41 |
+
**Acknowledgments:**
|
|
|
42 |
|
43 |
+
The sentiment analysis model uses BERT architecture from Hugging Face Transformers. The Amazon Fine Food Reviews dataset is for training. Gradio is used for the interactive interface.
|
44 |
|
|