File size: 5,634 Bytes
0e71525
 
 
 
 
 
 
 
 
 
 
 
d8c9b9a
 
00d4d28
 
d8c9b9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68b1d2f
 
d8c9b9a
68b1d2f
 
 
d8c9b9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50597e8
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
---
license: mit
task_categories:
- text-classification
- feature-extraction
language:
- en
tags:
- finance
size_categories:
- 10M<n<100M
---
## Enhancing Financial Market Predictions: Causality-Driven Feature Selection

**Note:[Please help give a Like ❤️ if you think this FinSen dataset is good for you, Thanks:)]**

This paper introduces FinSen dataset that revolutionizes financial market analysis by integrating economic and financial news articles from 197 countries with stock market data. The dataset’s extensive coverage spans 15 years from 2007 to 2023 with temporal information, offering a rich, global perspective 160,000 records on financial market news. Our study leverages causally validated sentiment scores and LSTM models to enhance market forecast accuracy and reliability.

### Technical Framework

![image](https://github.com/user-attachments/assets/2984d8d1-e827-488e-bc73-ed9677b86b64)



# Our FinSen Dataset
[![arXiv](https://img.shields.io/badge/stat.ML-arXiv%3A2006.08437-B31B1B.svg)](https://arxiv.org/abs/2408.01005)
[![Pytorch 1.5](https://img.shields.io/badge/pytorch-1.5.1-blue.svg)](https://pytorch.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/EagleAdelaide/FinSen_Dataset/LICENSE)

This repository contains the dataset for [*Enhancing Financial Market Predictions:
Causality-Driven Feature Selection*](https://arxiv.org/abs/2408.01005), which has been accepted in ADMA 2024.

If the dataset or the paper has been useful in your research, please add a citation to our work:

```
@article{liang2024enhancing,
  title={Enhancing Financial Market Predictions: Causality-Driven Feature Selection},
  author={Liang, Wenhao and Li, Zhengyang and Chen, Weitong},
  journal={arXiv e-prints},
  pages={arXiv--2408},
  year={2024}
}
```

### Datasets

**[FinSen]** can be downloaded manually from the repository as csv file. Sentiment and its score are generated by FinBert model from the Hugging Face Transformers library under the identifier "ProsusAI/finbert".  (Araci, Dogu. "Finbert: Financial sentiment analysis with pre-trained language models." arXiv preprint arXiv:1908.10063 (2019).)

**We only provide US for research purpose usage, please contact [email protected] for other countries (total 197 included) if necessary.**

![image](https://github.com/user-attachments/assets/f28e670a-7329-409d-81cb-1fe47da22140)

Finsen Data Sample:

<img width="341" alt="image" src="https://github.com/user-attachments/assets/6ab08486-85b7-4cf6-b4fe-7d4294624f91">

We also provide other NLP datasets for text classification tasks here, please cite them correspondingly once you used them in your research if any.

1. **20Newsgroups**. Joachims, T., et al.: A probabilistic analysis of the rocchio algorithm with tfidf for
text categorization. In: ICML. vol. 97, pp. 143–151. Citeseer (1997)

2. **AG News**. Zhang, X., Zhao, J., LeCun, Y.: Character-level convolutional networks for text
classification. Advances in neural information processing systems 28 (2015)

To download the AG News dataset and obtain its DataLoader in PyTorch, you can use the `torchtext` library, which provides convenient access to various text datasets, including AG News. Below is a step-by-step guide to achieve this:

#### Step 1: Install Required Libraries

If you don't have `torchtext` installed, you can install it using pip:

```bash
pip install torchtext
```
#### Step 2: Utilize ag_news.py in Dataloader

  1. **Download the Dataset**:
     - The `AG_NEWS` dataset is downloaded using `torchtext.datasets.AG_NEWS`. The `split=('train', 'test')` argument returns iterators for the training and test sets.
  
  2. **Tokenization**:
     - The `get_tokenizer('basic_english')` function is used to tokenize the text data.
  
  3. **Build Vocabulary**:
     - The `build_vocab_from_iterator` function constructs a vocabulary from the tokens in the dataset. Special tokens such as `<unk>` (unknown) are added to handle out-of-vocabulary words.
  
  4. **Text and Label Pipelines**:
     - `text_pipeline` converts text into a sequence of token indices based on the vocabulary.
     - `label_pipeline` converts labels (which are initially strings) into integers.
  
  5. **Collate Function**:
     - `collate_batch` is a custom function that processes batches by padding sequences and converting labels and texts into tensors.
  
  6. **DataLoader**:
     - `DataLoader` is used to create batches of data, shuffle them, and apply the `collate_fn` to each batch.

#### Step 3: Customization:

- You can change the `batch_size` and other parameters in the `DataLoader` to suit your needs. 
- The tokenizer and vocabulary can be customized for more complex preprocessing.
  
3. **Financial PhraseBank**. Malo, P., Sinha, A., Korhonen, P., Wallenius, J., Takala, P.: Good debt or bad debt:
Detecting semantic orientations in economic texts. Journal of the Association for
Information Science and Technology 65(4), 782–796 (2014)

### Dataloader for FinSen

We provide the preprocessing file finsen.py for our FinSen dataset under dataloaders directory for more convienient usage.

### Models - Text Classification

1. DAN-3. 

2. Gobal Pooling CNN.

### Models - Regression Prediction

1. LSTM

### Using Sentiment Score from FinSen Predict Result on S&P500

![image](https://github.com/user-attachments/assets/2d9b4dd7-7f59-425c-b812-2cca57719243)

### Dependencies

The code is based on PyTorch under code frame of https://github.com/torrvision/focal_calibration, please cite their work if you found it is useful.

:smiley: ☺ Happy Research !


---
license: mit
---