File size: 3,793 Bytes
8aa1124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6f3e61
8aa1124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# SentimentAnalysis
Sentiment analysis with NLTK (Folder 79) 
Sentiment analysis with Roberta (Folder 159)
Sentiment analysis with Roberta+Awk (Folder 209)
Sentiment analysis with Roberta+Gradio (Folder 219)

<!-- MARKER: Start of README -->

# Stock Sentiment Analysis of Tweets using RoBERTa


![Feature 1 Screenshot](Media/1.jpeg)
![Feature 1 Screenshot](Media/2.jpeg)
![Feature 1 Screenshot](Media/3.png)
![Feature 1 Screenshot](Media/4.png)
![Feature 1 Screenshot](Media/5.png)

## Table of Contents

- [Project Description](#project-description)
- [Objective](#objective)
- [Hypotheses](#hypotheses)
- [Data Collection](#data-collection)
- [Sentiment Analysis](#sentiment-analysis)
- [Machine Learning Model](#machine-learning-model)
- [Running the Model](#running-the-model)
- [Huggingface](https://huggingface.co/sudhanvasp/Sentiment-Analysis)
- [Results and Insights](#results-and-insights)
- [License](#license)

---

<!-- MARKER: Project Description -->

## Project Description

Welcome to the Stock Sentiment Analysis project! This repository houses the code and resources for analyzing Twitter data to predict stock price movements based on sentiment analysis, leveraging the powerful RoBERTa model. Gain valuable insights into market sentiment and enhance your trading strategies.

<!-- MARKER: Objective -->

## Objective

The primary aim of this project is to explore the intricate relationship between sentiment expressed in tweets and short-term stock price movements.

<!-- MARKER: Hypotheses -->

## Hypotheses

- *Hypothesis 1:* Tweets with a positive sentiment will exhibit a positive correlation with stock price increases.
- *Hypothesis 2:* Tweets with a negative sentiment will display a negative correlation with stock price decreases.
- *Hypothesis 3:* Tweets with a neutral sentiment will display a neutral correlation with stock price.

<!-- MARKER: Data Collection -->

## Data Collection

- We meticulously gathered Twitter data from financial news and analyst accounts.
- Data preprocessing was performed, encompassing deduplication, tokenization, and sentiment label encoding (positive, negative, neutral).

<!-- MARKER: Sentiment Analysis -->

## Sentiment Analysis

- Harnessing RoBERTa, a state-of-the-art transformer-based model, we assigned sentiment scores.
- Challenges such as domain-specific sentiment expressions and model fine-tuning were addressed.

<!-- MARKER: Machine Learning Model -->

## Machine Learning Model

- Our model is a robust ensemble of RoBERTa.
- Features encompass RoBERTa-generated F1 scores, tweet volume, and historical stock price data.
- This amalgamation empowers us to capture both sequential dependencies and non-linear relationships effectively.

<!-- MARKER: Running the Model -->

## Running the Model

## Hosting with Gradio

1. *Install Gradio:*
   ```bash
   pip install gradio
   import gradio as gr

2. Run the given gradio code in the Folder 219.
## Hosting with FLASK

1. *Install FLASK:*
   ```bash
   pip install flask
   cd 209
   cd twitterka
   python app.py 

2. Open the IP given address.
<!-- MARKER: Project Description -->

## Huggingface Page
- Execution of the model can be done directly on Huggingface as well
- [Huggingface](https://huggingface.co/sudhanvasp/Sentiment-Analysis)


<!-- MARKER: Results and Insights-->

## Results and Insights

- Our ensemble model boasts an impressive 96% accuracy in sentiment analysis.
- Notably, positive sentiment tweets correlate positively with stock price increases, while negative sentiment tweets correlate negatively with decreases. Neutral sentiment, while present, exhibits a weaker influence on stock price movements.

  
<!-- MARKER: License-->
## License

- This created by the team "The Lost Pendrive" (Sudhanva SP, Deepa Umesh, Chinmayi Rajaram)