Code for AI Open Paper: Heterogeneous Graph Knowledge Enhanced Stock Market Prediction
Some code are borrowed from HeterSumGraph. Thanks for their work.
The data format should be jsonlines, each line should be like this:
{
"sentences": ["sentence1", "sentence2", ...],
"events": [["subj_1", "v_1", "obj1"], ["subj_2", "v_2", "obj2"], ...],
"lable": 1,
"crop": "apple inc",
"e2e_edges": [[0, 1], [1, 3], ...],
"e2s_edges": [[0, 1], [1, 2], ...]
}
- sentences: the set of sentences in news documents;
- events: the set of event triples extracted from sentences;
- crop: the corporation whose stock prices need to be predicted;
- label: 0 and 1 represents the stock price of the "crop" will decline and rise, respectively;
- e2e_edges: connections between two events, [0, 1] represents the first event is connected with the second one;
- e2s_edges: connections between sentences and events, [0, 1] represents the first event is connected with the second sentence.
We use CoreNLP for event extraction.
TF-IDF files generation can refer to HeterSumGraph.
Raw Data can refer to here.
Processed data can refer to here, password: 19i0
.
For training, you can run the commands like this:
python train_stock.py
For evaluation, you can run commands like this:
python auc.py
If you find the paper or the resource is useful, please cite our work in your paper:
@article{xiong2021heterogeneous,
title={Heterogeneous graph knowledge enhanced stock market prediction},
author={Xiong, Kai and Ding, Xiao and Du, Li and Liu, Ting and Qin, Bing},
journal={AI Open},
volume={2},
pages={168--174},
year={2021},
publisher={Elsevier}