-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
244 lines (232 loc) · 15 KB
/
index.html
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<!DOCTYPE html>
<html lang="he">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>שימוש ברשתות חברתיות לניבוי שוק ההון</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>שימוש ברשתות חברתיות לניבוי שוק ההון</h1>
</header>
<div class="background">
<img src="images/background1.jpg" alt="רקע">
</div>
<section id="introduction">
<h2>הקדמה</h2>
<p>
הרשת החברתית "טוויטר", מפורסמת בשל השפעתה המשמעותית במגוון תחומים כגון פוליטיקה, כלכלה וביטחון.
במטרה לחקור את ההשפעה של טוויטר על שוק ההון,
אנו מעוניינים לבדוק באיזו מידה ציוצים משפיעים על התנודות בשווקים. התנודות בשוק המניות מושפעות מגורמים רבים,
דבר אשר הקשה על יכולת חיזוי מדויקת של תנועות עתידיות בשוק בהסתמך על הציוצים.
</p>
<p>
בכדי להתמודד עם בעיה זו, אנו מציעים גישה המשלבת את הציוצים מרשת הטוויטר עם נתוני שוק מהעבר.
על ידי זיהוי סנטימנט הציוצים של אישי עולם בכירים.
מטרתו של המודל שלנו הוא לחזות את מחיר המנייה בעזרת סנטימנט הציוצים ונתוני העבר של המנייה.
</p>
<p>
המחקר מתמקד במניית ה-S&P 500, הכוללת את 500 החברות הגדולות בבורסות הציבוריות בארצות
הברית.
בנוסף, אנו אוספים נתוני מניות באמצעות ממשק ה-API של אתר Yahoo Finance, אנו אוספים את המידע מתאריך 01/02/2017 עד
תאריך 31/12/2020, סך כולל של 986 ימי סחר.
</p>
<p>
את ציוצי המשפיענים שאנו עוקבים אחריהם נאסוף מאתר Github, אנו אוספים את הנתונים באותו טווח של נתוני
המניות, למעט ימים בהם אין סחר.
</p>
</section>
<section id="data-preprocessing">
<h2>עיבוד נתונים</h2>
<p>
כל הנתונים המובאים כוללים 39,346 ציוצים כוללים:
<ul>
<li>טים קוק - 540 ציוצים</li>
<li>ביל גייטס - 1,095 ציוצים</li>
<li>אילון מאסק - 9,658 ציוצים</li>
<li>דונלד טראמפ - 22,855 ציוצים</li>
<li>ג'ו ביידן - 5,044 ציוצים</li>
<li>ג'ף בזוס - 154 ציוצים</li>
</ul>
</p>
<p>
בשלב הראשוני היה צורך לעבד את הנתונים. הסרנו את כל התווים הלא רלוונטיים והתמקדנו רק בטקסט הרלוונטי
של הציוץ. כמו כן, ניתן היה לראות ימים בהם יש סחר בבורסה אך אין ציוצים לאותו המשפיען במצב כזה השלב המקובל היה למלא ימים אלו
עם ערכי ממוצע לאותו יום מתוך הציוצים הקרובים של אותו משפיען.
</p>
</section>
<section id="sentiment-analysis">
<h2>ניתוח רגשי</h2>
<p>
לאחר עיבוד הנתונים ביצענו ניתוח רגשי באמצעות כלי ה-VADER (Valence Aware Dictionary and sEntiment Reasoner).
כלי זה מיועד לניתוח ולסיווג של רגשות בטקסטים. הוא משתמש בלקסיקון של מילים וכללים
לקביעת רמת הרגש בכל ציוץ.
</p>
<p>
תוצאות ניתוח הרגש מתייחסות לכל ציוץ וציוץ בנפרד ממאגר הנתונים.כאשר הערך שמתקבל לכל ציוץ הוא בין -1 עד 1,
כאשר -1 מייצג ציוץ מאוד שלילי, 0 מייצג ציוץ נייטרלי ו-1 מייצג ציוץ מאוד חיובי.
</p>
<p>
ניתוח רגשות באמצעות VADER יעיל עבור ציוצים וטקסטים קצרים אחרים כיוון בעיקר כשמדובר על טקסטים בשפה יומיומית ולא בשפה פורמלית. הוא מועיל בפרויקט זה מכיוון שהשפה בציוצים היא יומיומית וקצרה, אשר לעיתים קרובות
מכילה שגיאות כתיב ולשון דיבור. כך שהוא מספק כלי חזק וקל לשימוש לניתוח הרגשות בציוצים וטקסטים דומים.
</p>
</section>
<section id="lstm-model">
<h2>מודל LSTM</h2>
<p>
נשתמש ברשתות עצביות LSTM כדי למדל את הקשר בין הציוצים לשינויים בשוק המניות.
רשתות עצביות LSTM הן סוג של רשת עצבית חוזרת (RNN) שיכולה ללכוד את התלות ארוכת הטווח בנתונים עוקבים ,
המשמשת בדרך כלל במשימות עיבוד שפה טבעית (NLP)
כגון תרגום מכונה, סיכום טקסטים ומענה לשאלות.
</p>
<p>
הרשת עובדת באמצעות מנגנוני שער כדי לשלוט בזרימת המידע דרך הרשת, היא מורכבת משלושה מנגנוני שער: שער כניסה, שער שכח ושער יציאה.
שער הקלט שולט על כמות המידע החדש הנכנס אל הרשת ומתווסף למצב תא, שער השכח שולט על כמות המידע שנשכח ממצב התא ונמחק מהרשת ושער היציאה שולט על כמות המידע היוצא ממצב התא.
בגלל המנגנון שבו בנויה רשת LTSM הרשת מסוגלת ללמוד תלות ארוכת טווח מכיוון שהיא יכולה לזכור מידע במשך תקופה ארוכה בניגוד לרשתות עצביות אחרות כמו RNN שיכולות לזכור מידע לפרקי זמן קצרים.
</p>
<h3>משוואת המודל ללא סנטימנט</h3>
<p>כאשר 𝑺𝒕 הוא הערך החזוי של הערך היומי של S&P 500 בזמן 't', 𝑺𝑷𝟓𝟎𝟎𝒕−i הן הערכים היומיים מהעבר בפיגור של i.
<br>
במודל הטוב ביותר שנבחר ללא סנטימנט ערך ה-i הוא 8 (ימים)
</p>
<img src="images\eq without sentiment.png" alt="משוואה ללא סנטימנט">
<h3>משוואת המודל עם סנטימנט</h3>
<p>כאשר 𝑺𝒕 הוא הערך החזוי של הערך היומי של S&P 500 בזמן 't', 𝑺𝑷𝟓𝟎𝟎𝒕−i הן הערכים היומיים מהעבר בפיגור של הערך i, 𝑺𝑰𝒕−i הם ערכי אינדקס הסנטימנט מהעבר, בפיגור של i.
<br>
ערך ה-i שנבחר למודלים שלנו הוא פיגור של 1 ימים.
</p>
<img src="images\eq with sentiment.jpg" alt="משוואה עם סנטימנט">
</section>
<section id="evaluation-metrics">
<h2>שיטות השגיאה</h2>
<p>
למודלים של LSTM,
כמו גם למודלים אחרים של רגרסיה, אין מדד דיוק פשוט כמו במודלים של סיווג.
בהקשר של סיווג, מודד את אחוז התחזיות הנכונות מתוך כלל התחזיות שנעשו על ידי המודל, שיטה אשר אינה ישימה ישירות למשימות רגרסיה. ברגרסיה, מדדי ההערכה מתמקדים במדידת הקרבה של הערכים החזויים לערכים בפועל.
<br>
השתמשנו בשלושה מדדים עיקריים לשגיאה:
<ul>
<li><strong>Mean Absolute Error (MAE):</strong> מדד המשמש להערכת ביצועי מודל רגרסיה. מודד את הפער בין ערכי היעד הצפויים לבין הערכים שניתנו על ידי המודל. יתרון ה-MAE שהוא מתייחס לשונות בצורה פוזיטיבית בלבד, כלומר, מחשב את הפער הממוצע בין הערכים בלבד, בלי להשוות ערך משלילי לערך חיובי.</li>
<li><strong>Root Mean Squared Error (RMSE):</strong> שגיאה המודדת את ההבדל הממוצע בין הערכים החזויים של המודל הסטטיסטי לבין הערכים שקיבלנו בפועל. מבחינה מתמטית זוהי סטיית התקן של המרחקים בין הנקודות לבין קו הרגרסיה, ככל שהמספר נמוך יותר כך אנחנו יודעים שהמודל שלנו מדייק יותר.</li>
<li><strong>R-squared (R²):</strong> מדד זה משקף את אחוז ההסבר של המודל לשטח הנתונים. ערך של R² של 1 משמעו
שהמודל מסביר בצורה מושלמת את הנתונים, בזמן שערך של 0 משמעו שהמודל אינו מסביר כלל את הנתונים. מקובל כי ערך
גבוה של R² מעל 0.8 טוב מאוד ומראה על יכולת המודל להסביר את השוק.</li>
</ul>
</p>
</section>
<section id="results">
<h2>תוצאות</h2>
<p>
לאחר הרצת המודל והשוואת התוצאות למציאות, הגענו למסקנה כי המודל הציג מדדי שגיאה נמוכים ויכול
לספק תחזיות מהימנות למחירי המניות במהלך התקופה שנבדקה. עם זאת, חשוב לציין כי התחום עשוי להשתנות בהתאם
לתקופה ולתנאים המקומיים.
</p>
</section>
<div class="results-table">
<table>
<thead>
<tr>
<th>משפיען</th>
<th>R²</th>
<th>MAE</th>
<th>RMSE</th>
</tr>
</thead>
<tbody>
<tr>
<td>ללא סנטימנט</td>
<td>0.93992</td>
<td>0.03733</td>
<td>0.04734</td>
</tr>
<tr>
<td>טים קוק</td>
<td>0.97089</td>
<td>0.02781</td>
<td>0.03622</td>
</tr>
<tr>
<td>ביל גייטס</td>
<td>0.96106</td>
<td>0.03323</td>
<td>0.04190</td>
</tr>
<tr>
<td>אילון מאסק</td>
<td>0.95794</td>
<td>0.03440</td>
<td>0.04354</td>
</tr>
<tr>
<td>דונלד טראמפ</td>
<td>0.97080</td>
<td>0.02791</td>
<td>0.03628</td>
</tr>
<tr>
<td>ג'ו ביידן</td>
<td>0.97040</td>
<td>0.02812</td>
<td>0.03653</td>
</tr>
<tr>
<td>ג'ף בזוס</td>
<td>0.97158</td>
<td>0.02686</td>
<td>0.03579</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="graphs">
<h2>גרפים</h2>
<p>בתרשימים הבאים ניתן לראות את תוצאות החיזוי של המודלים השונים כאשר מחיר המנייה האמיתי הוא באדום והמחיר שהמודל חוזה הוא בכחול.
<br>
ציר ה-y בגרפים מייצג את מחיר המנייה המנורמל.
<br>
ציר ה-x מייצג את פרק הזמן שעבר מתחילת המודל בימים.
</p>
<div class="graph">
<h3>מודל ללא סנטימנט</h3>
<img src="images/model_without_sentiment.png" alt="ללא סנטימנטים">
<p>הגרף מציג את התוצאות של החיזוי של המודל ללא ניתוח סנטימנטי על ה-S&P 500.</p>
</div>
<div class="graph">
<h3>טים קוק</h3>
<img src="images/model_tim.png" alt="גרף של טים קוק">
<p>הגרף מציג את התוצאות של החיזוי בהשפעת ציוצי טים קוק על ה-S&P 500.</p>
</div>
<div class="graph">
<h3>ביל גייטס</h3>
<img src="images/model_bill.png" alt="גרף של ביל גייטס">
<p>הגרף מציג את התוצאות של החיזוי בהשפעת ציוצי ביל גייטס על ה-S&P 500.</p>
</div>
<div class="graph">
<h3>אילון מאסק</h3>
<img src="images/model_musk.png" alt="גרף של אילון מאסק">
<p>הגרף מציג את התוצאות של החיזוי בהשפעת ציוצי אילון מאסק על ה-S&P 500.</p>
</div>
<div class="graph">
<h3>דונלד טראמפ</h3>
<img src="images/model_trump.png" alt="גרף של דונלד טראמפ">
<p>הגרף מציג את התוצאות של החיזוי בהשפעת ציוצי דונלד טראמפ על ה-S&P 500.</p>
</div>
<div class="graph">
<h3>ג'ו ביידן</h3>
<img src="images/model_biden.png" alt="גרף של ג'ו ביידן">
<p>הגרף מציג את התוצאות של החיזוי בהשפעת ציוצי ג'ו ביידן על ה-S&P 500.</p>
</div>
<div class="graph">
<h3>ג'ף בזוס</h3>
<img src="images/model_jeff.png" alt="גרף של ג'ף בזוס">
<p>הגרף מציג את התוצאות של החיזוי בהשפעת ציוצי ג'ף בזוס על ה-S&P 500.</p>
</div>
</section>
<footer class="footer" dir="ltr" lang="en">
<p>© 2023 Maor Israeli & Vladimir Alkin</p>
</footer>
<script src="script.js"></script>
</body>
</html>