--- title: "當AI遇上財經-利用Graph Neural Network分析財經市場 When AI Meets Finance: Using Graph Neural Network to Analyze Financial Market - William Chang" tags: PyConTW2023, 2023-organize, 2023-共筆 --- # 當AI遇上財經-利用Graph Neural Network分析財經市場 When AI Meets Finance: Using Graph Neural Network to Analyze Financial Market - William Chang {%hackmd H6-2BguNT8iE7ZUrnoG1Tg %} <iframe src=https://app.sli.do/event/vxoyxhDW9L6KHG7QhMUws2 height=450 width=100%></iframe> > Collaborative writing start from below > 從這裡開始共筆 ## Time Series X 軸是時間的資料 + Non-stationarity + Stationarity + Distribution does not change over time + First-order stationarity + Second-order stationarity + As for analysis of time series data, the data has to be at lease first-order stationarity ### Why 財經市場難分析? + **Autocorrelation** + corr over time + no 2nd stationarity + **Exogeneity** + Big env, industry + eg. industry chain, global eco + **Volatility** + no 1st stationatiry + Unexpected events + e.g. pandemic 除了最後一個外,都有方法解決 ### Autocorrelation & Volatility #### Feature + 資料取Lag(one-period diff) + Normalization(Min-max scalar) #### Model Selection + CNN + LSTM + Forget Gate: tackles gradient ... ### Exogeneity #### Feature + Economy indices + 例如可以從FRED取得額外的一些information #### Model Selection + Graph Neural Network: + Graph ## Graph Neural Network (GNN) ### Graph + Objects (**Nodes**) and ther relation (**Edges**) + A node in a graph Gt represents an object's present value + In our case, a stock's/index's value at time t ### GNN Variants + **Aggregation**: + taking mean/max/min of the nodes over a graph + **Combination**: + Weights of the edges + Homogeneous v.s. Heterogeneous + 常見變種 + GCN (Graph Convolutional Network): + GraphSAGE + weighted mean(Aggregation + Combination) + GAT(Graph Attention Network) + Mean-pooling + self-learning heterogeneous edge weight ## Data > data preparation and feature extraction ### Train/Test Split - Rolling window (better) - Wxpanding window ### Metrics - Mean Percentage Error - Mean Percentage Absolute Error ## Model Below is the part that speaker updated the talk/tutorial after speech 講者於演講後有更新或勘誤投影片的部份 Slide 連結: https://docs.google.com/presentation/d/1OK_G9lLmiYelaii3hq35xomRYOiVGJW_SZNuI6DuRx4/edit?usp=sharing