Stock Market Forecasting Using Machine Learning Algorithms 機械学習アルゴリズムを利用した株式市場予測

【WIP】要約

  • 上昇や下降といった株式市場の動向を予測
  • NASDAQの市場動向を予測するのにNASDAQの過去データよりもNASDAQ以外の市場動向を使う方がいい
  • 予測精度にもっとも貢献する特徴を選択するアルゴリズムを提案
  • 日々の市場動向と長期間の動向の組み合わせが最良の結果を提供
  • 単一特徴予測で予測精度が70.8%
  • 期間データが30日で予測精度が85%
  • SVMとMARTによる学習器の精度は74%

【WIP】全訳

Stock Market Forecasting Using Machine Learning Algorithms
機械学習アルゴリズムを利用した株式市場予測


Abstract
概要


Prediction of stock market is a long-time attractive
topic to researchers from different fields.
株式市場の予測は異なる分野の研究者から長期にわたって魅力的な話題である。


In particular, numerous studies have been conducted to predict
the movement of stock market using machine learning algorithms
such as support vector machine (SVM) and reinforcement learning.
とりわけ、数多くの研究がサポートベクターマシーン(SVM)や強化学習といった機械学習
アルゴリズムを使用して株式市場の動向を予測するために行われてきた。


In this project, we propose a new prediction algorithm that exploits
the temporal correlation among global stock markets and various
financial products to predict the next-day stock trend with the
aid of SVM.
このプロジェクトでは、世界的な株式市場間の一時的な相互関係を利用した新しい予測アルゴリズム
SVMの助けを借りて翌日の株式動向を予測する様々な金融製品を提案する。


Numerical results indicate a prediction accuracy of
74.4% in NASDAQ, 76% in S&P500 and 77.6% in DJIA.
数値的な結果はNASDAQ(アメリカ合衆国証券取引所)で74.4%、
S&P500(Standard & Poor's 500 Stock Indexの略称で、アメリカ合衆国の投資情報会社
であるスタンダード・アンド・プアーズ社が算出しているアメリカの代表的な株価指数)で76%、
DJIA(Dow Jones Industrial Averageの略称で、ダウ・ジョーンズ社が発表する、
工業株30銘柄を対象とした平均株価指数)で77.6%の予測精度を指し示す。


The same algorithm is also applied with different regression
algorithms to trace the actual increment in the markets.
アルゴリズムが市場における現実的な増加!?を追跡するために
異なる回帰アルゴリズムもまた適用されている。


Finally, a simple trading model is established to study the performance
of the proposed prediction algorithm against other benchmarks.
最後に、ほかの基準に対して、提案した予測アルゴリズムの性能を調査するために
単純な取引モデルが確立されている。


1 INTRODUCTION
1 導入


Prediction of stock trend has long been an intriguing topic
and is extensively studied by researchers from different fields.
株式動向の予測は長い間好奇心をそそる話題であり、異なる分野の研究者から広く
研究されてきた。


Machine learning, a well-established algorithm in a wide range
of applications, has been extensively studied for its potentials
in prediction of financial markets.
広範囲の応用で定評のあるアルゴリズムである機械学習は金融市場の予測でその
可能性を広く研究されてきた。


Popular algorithms, including support vector machine (SVM) and
reinforcement learning, have been reported to be quite effective
in tracing the stock market and help maximizing the profit of
stock option purchase while keep the risk low [1-2].
SVMや強化学習を含む人気のアルゴリズムは株式市場を追跡することにかなり有効で
あることやリスクを低くくしたままストックオプションの購入による利益を最大化するのに
役立つことを報告されている。


However, in many of these literatures, the features selected
for the inputs to the machine learning algorithms are mostly
derived from the data within the same market under concern.
しかしながら、これらの文献の多くで、機械学習アルゴリズムへの入力で選択された
特徴はたいてい懸念があるままそれと同じ市場にあるデータから引き出されている。


Such isolation leaves out important information carried by other
entities and make the prediction result more vulnerable to local perturbations.
そのような孤立はほかの市場から伝えられる重要な情報を除外し局所的な混乱に対して
予測結果がより影響を受けやすくなる。


Efforts have been done to break the boundaries by
incorporating external information through fresh financial
news or personal internet posts such as Twitter.
新鮮な金融ニュースやTwitterのような個人的なインターネットのポストを通して
外部的な情報を組み入れることによって境界を破壊するための努力がなされてきた。


These approaches, known as sentiment analysis, replies on the
attitudes of several key figures or successful analysts in the
markets to interpolate the minds of general investors.
センチメント分析として知られているこれらのアプローチは一般的な投資者の心情に
さしはさむ市場でいくつかの重要な数字や成功した分析の態度に答える。


Despite its success in some occasions, sentiment analysis may fail
when some of the people are biased, or positive opinions
follow past good performance instead of suggesting promising
future markets.
ある場合における成功にもかかわらず、一部の人々が先入観を持ったり、積極的な意見が
未来の市場を約束する提案をする代わりに過去のよい成績に従うとき、
センチメント分析は失敗するかもしれない。


In this project, we propose the use of global stock data in
associate with data of other financial products as the input
features to machine learning algorithms such as SVM.
このプロジェクトでは、SVMといった機械学習アルゴリズムに対する入力の特徴として
ほかの金融製品のデータと関連をもった世界的な株式データの利用を我々は提案する。


In particular, we are interested in the correlation between the
closing prices of the markets that stop trading right before or at
the beginning of US markets.
とりわけ、取引終了直前の市場の終値とUSマーケットの開始間の相互関係に我々は
興味がある。


As the connections between
worldwide economies are tightened by globalization, external
perturbations to the financial markets are no longer domestic.
世界的な経済間の関係がグローバリゼーションによって密接になると、金融市場に
対する対外的な混乱はもはや国内ではおさまらない。


It is to our belief that data of oversea stock and other financial
markets, especially those having strong temporal correlation
with the upcoming US trading day, should be useful to
machine learning based predictor, and our speculation is
verified by numerical results.
海外の株データとほかの金融市場とりわけ今度のアメリカの取引日における一時的な
強固の相互関係は予測者に基づいた機械学習にとって有用であるはずだというのが
我々の信念である。そして、我々の推測は数値的な結果によって確かめられる。


The rest of the report is organized as following.
残りの報告は後に続くように構成されている。


Section II presents our algorithm in details, including the fundamental
principle of our algorithm, data collection and feature selection.
2節は我々のアルゴリズムの基本的な原理、データ収集そして特徴の選択を含む我々のアルゴリズム
詳細に紹介する。


Numerical results are shown in Section III followed by analysis
and discussions.
数値的な結果は分析と議論に続く3節で示される。


In Section IV, we established a simple trading
model to demonstrate the capability of the proposed algorithm
in increasing profit in NASDAQ.
4節では、NASDAQで利益を増加させる提案されたアルゴリズムの性能を説明するための簡単な
取引モデルを我々は確立した。


Section V summarizes the whole report.
5節で報告全体を要約する。


2 ALGORITHMS
2 アルゴリズム


A. Basic Principles
A. 基本的な原理


Globalization deepens the interaction between the financial
markets around the world.
グローバリゼーションは世界中の金融市場間の相互作用を深める。


Shock wave of US financial crisis
hit the economy of almost every country and debt crisis
originated in Greece brought down all major stock indices.
金融危機の衝撃波はほぼすべての国の経済を襲い、ギリシャから始まった借金危機は
すべての主要な株式指標を下げた。


Nowadays, no financial market is isolated.
近頃は、どの金融市場も孤立していない。


Economic data, political perturbation and any other oversea
affairs could cause dramatic fluctuation in domestic markets.
経済データ、政治的混乱そしてほかのいかなる海外の事件が国内市場の劇的な変動
をもたらしうる。


Therefore, in this project, we propose to use world major stock
indices as input features for our machine learning based predictor.
よって、このプロジェクトでは、予測器に基づく我々の機械学習に対する入力の特徴として
世界的に主要な株価指数の利用を我々は提案する。


In particular, the oversea markets that closes right before or at
the beginning of the US market trading should provide valuable
information on the trend of coming US trading day, as their movements
already account for possible market sentiment on latest
economic news or response to progress in major world affairs.
とりわけ、米国の株式取引の開始と終了における海外の市場は次に来る米国の取引日の動向
に対して役立つ情報を提供するはずだ。なぜなら、それらの動きが最新の経済ニュースに対して
ありそうな市場のセンチメントを説明したり、世界の主要な問題の成り行きに反応するからだ。


In addition to stock markets, commodity prices and foreign
currency data are also listed as potential features, as different
financial markets are interconnected.
株式市場に加えて、異なる金融市場が相互接続するので、物価指数や外国通貨データもまた
見込みのある特徴としてリスト化される。


For instance, slowdown in US economy will definitely cause a drop in
US stock market.
たとえば、米国経済の低迷は米国株式市場の降下をもたらす。


But at the same time, USD and JPY will increase with respect
to its peers as people seek for asset havens.
しかし同時に、人々が資産の安息所を求めるにつれて米ドルと円は関連して
上がっていくだろう。


Such interplay implies the underlying relationship between these
financial products and the possibility of using one or some of them to
predict the move of the other ones.
そのような相互作用はこれらの金融商品ともう一方の動きを予測するのにひとつまたはそれらの一部を使う
可能性間に基本的な関連性があることを暗示する。


B. Data collection
B. データ収集


The data set used in this project is collected from [3].
このプロジェクトで使用されたデータセットは[3](http://www.wikiposit.org/)から集められている。


It contains 16 sources as listed in Table I and covers daily price
from 04-Jan-2000 to 25- Oct -2012: Since the markets are
closed on holidays which vary from country to country, we use
NASDAQ as a basis for data alignment and missing data in
other data sources is replaced by linear interpolation.
それは表1にリスト化されているように16個のソースを含んでおり2000年1月4日から2012年10月25日の
毎日の価格を含んでいる。国によってまちまちだが市場は休日に閉まるので、
我々はデータを揃えるための基準としてNASDAQを利用しほかのデータソースにおいて欠落したデータは
線形補間によって置き換えた(補った)。


C. Feature Selection
C. 特徴選定


In this project, we focus on the prediction of the trend of
stock market (either increase or decrease).
このプロジェクトでは、(上昇または下降)といった株式市場の動向を予測するのに
我々は集中する。


Therefore, the change of a feature over time is more important than the
absolute value of each feature.
したがって、時間外における特徴の変化は各特徴の絶対的な値よりもより重要である。


We define xi(t), where i ∈ {1,2,..., 16}, to be feature i at time t.
我々はiは1から16までの値を取り時間tにおける特徴iをxi(t)で定義する。


The feature matrix is given by
F = (X1, X2, ..., Xn)T (1)
where
Xt = (x1(t),x2(t),...,x16(t)) (2)
その特徴行列は(2)の元における(1)で与えられる。
[補足]
Xtは時刻tにおける特徴1から特徴16までの特徴ベクトルで、Fは時刻1から時刻nまでの特徴ベクトルのベクトル
の転置行列になっている。


The new feature which is the difference between two daily
prices can be calculated by
2日間の価格の差異である新しい特徴は次の式によって計算できる


Due to the difference in market value and basis of each
market, the differential values calculated above can vary in a
wide range.
市場価値と各市場の原則の差異によって、上記で計算された差分価値は幅広く変わりうる。


To make them comparable, the features are normalized as following:
それらを比較できるように、特徴は後に続くように正規化される。


and the normalization can be implemented as:
そして、正規化は以下のようにして実装できる


As discussed above, the performance of a stock market
predictor heavily depends on the correlation between the data
used for training and the current input for prediction.
上記で議論したように、株式市場予測器の性能は訓練のために使用したデータと予測のための現在の入力の相互関係
に大いに依存している。


Intuitively, if the trend of stock price is always an extension to
yesterday, the accuracy of prediction should be fairly high.
直感的に、株価の動向は常に昨日の拡張であるならば、予測の精度はかなり高いはずだ。


To select input features with high temporal correlation, we
calculated the autocorrelation and cross-correlation of different
market trends (increase or decrease).
一時的に高く相互関係のある入力特徴を選択するために、異なる市場動向(増加または減少)
の自己相関と相互相関を我々は計算した。


The results shown in Figure 2 use NASDAQ as the base market.
図2で示される結果は基準の市場としてNASDAQを使用する。


It can be seen from the graph that the autocorrelation of
NASDAQ daily trend is only non-zero at the origin based on
which we may conclude that the trend of NASDAQ daily index
is approximately a Markov process.
NASDAQの日々の動向の自己相関はNASDAQの日々の指数の動向はおおよそマルコフ過程
であるかもしれないと結論付けたのに基づいた原因で非0だけである!?。


Hence, past data of NASDAQ will not provide much insight to its future
movement.
だから、NASDAQの過去データは未来の動きにそれほどの知見は提供しないだろう。


The same conclusion could be made on many other
data sources whose cross-correlation with NASDAQ is close to
zero.
同じ結論はNASDAQの相互相関が0に近いというほかの多くのデータソースでもなされる。


Although the trend of DJIA and S&P500 have strong
correlation with NASDAQ given the data are on same day,
they are not available by the time they are needed for
prediction.
同じ日のデータが与えられたときに DIJA や S&P500 の動向がNASDAQと強い相関がある
にもかかわらず、予測するために必要なときには手に入れることができない。


However, data sources such as DAX AUD and
some other markets are promising features for our predictor
built by machine learning algorithm as they have relative high
correlation with NASDAQ at the origin and their data is
available before or at the beginning of the US market trading
time.
しかしながら、DAX AUDやほかの市場のデータソースは初期のNASDAQと比較的高い相関があり
それらのデータはUS市場取引時間の前か最初で入手可能なので、それらは機械学習アルゴリズム
によって構築する予測器にとって将来有望な特徴である。


This observation actually confirms our forecast principle,
as discussed in previous sections, about the inter-connection
between global markets and how the information reflected by
their movements can be beneficial to the prediction of US
stock markets.
この観察は前節で議論したように、グローバル市場間の相互接続について実際に我々の予測原理を確証し、
どう情報がそれらの動きよって影響を受けるかは米国株式市場の予測にとって有益である。


In addition to the correlation of daily market movements, it
is also worth investigating the correlation of market trends in
longer term, which may also offer valuable information for
predicting future price [4-5].
日々の市場動向の相互関係に加えて、より長期的な期間における市場動向の相互関係を調査することにもまた
価値がある。それは未来の価格を予測するための貴重な情報もまた提供してくれるかもしれない。


To study this, δ in Eq. (3) is varied from 1 day to 50 days, and part of the results
are plotted in Figure 3.
それを研究するため、式(3)における δ は1日から50日まで変え、その結果の一部は図3に記されている。


As can be seen from the graph, temporal correlations between the markets increase with
the time window δ over which the trends of stock indices are calculated.
グラフからわかるように、市場間の一時的な相互関係は株式指数の動向が計算された時間窓δにわたって強くなる。


One explanation for this phenomenon is that the calculation in
Eq. (3) makes the time spans of the outputs overlap with each
other and therefore increase the temporal correlations.
この現象のひとつの説明は式(3)の計算は出力の時間幅を互いに重複させ
それゆえに一時的な相互関係を強くする。


Moreover, the operation also implicitly conduct an averaging
on the data within the interval which effectively removes the
noise and the underlying correlation between the markets
become clearer.
さらに、ノイズを効率的に削除する間隔内のデータを平均化する作業を暗に行い、
市場間にある潜在的な相互関係がより明確になる。


Given all possible features, we implemented forward
feature selection algorithm to select the features that contribute
most to the accuracy of prediction using different machine
learning algorithms.
すべてのありうる特徴が与えられるとしたら、異なる機械学習アルゴリズムを使い
予測精度にもっとも貢献する特徴を選択する前方特徴選択アルゴリズムを実装した。


Detail results are presented in the next section.
詳細な結果は次節で紹介される。


As expected, a combination of daily market trend and
long term movement provide the best result.
予期しているように、日々の市場動向と長期間の動向の組み合わせが
最良の結果を提供する。


III. EXPERIMENTAL RESULTS AND DISCUSSION
III. 実験的な結果と議論

A. TrendPrediction
A. 流行予測

1) Single Feature Prediction
1) 単一の特徴による予測


In section 2, we used cross-correlation to estimate the importance of each feature.
2節では、各特徴の重要性を評価するために我々は相互相関を使用した。


To verify the information given by correlation analysis, we use individual feature
to predict daily NASDAQ index trend.
相関分析によって得られた情報を確かめるために、毎日のNASDAQ指数の動向を予測するために個々の特徴を我々は使用する。


The prediction accuracy by each single feature is shown in Figure 4.
各単一の特徴による予測精度は図4で示される。


From the figure, we can see that DAX yields the best results, 70.8% accuracy of prediction.
図から、DAXは最良の結果を生み、予測精度は70.8%であることがわかる。


Prediction accuracies of Australian dollar, FTSE and oil price are also relatively high,
reaching 67.2%, 66.4% and 65.2% respectively.
オーストラリアドル、FTSE(株式や債券などの指数作成、管理をする、イギリスのロンドンに拠点を置く企業)、石油価格の
予測精度もかなり高く、それぞれ67.2%、66.4%、65.2%に達する。


The result of this experiment supports the analysis of cross- correlation.
この実験の結果は相互相関分析を援護する。


Hence, we are convinced that index value of other stock markets and commodity prices can
provide useful information in the prediction process.
だから、ほかの株式市場と商品価格の指標値は予測過程に対して役に立つ情報を提供しうる。


2) Long Term Prediction
2) 長期間の予測


Besides daily movement, sometimes we also care about prediction results for longer terms.
日々の動きに加えて、ときには長期間の予測結果にも注意する。


Here, we define our problem as predicting the sign of difference between tomorrow’s index
value with respect to that of certain days ago.
なので、我々の問題を数日前の指標値と明日の指標値の差異のサインを予測するものとして定義する。


We use SVM as a training model and the
prediction accuracies under different time spans are shown in Figure 5.
我々はSVMを訓練させるモデルとして使用し、異なるタイムスパン下における予測精度は図5に示される。


From the figure, we can see that prediction accuracy increases when time span becomes longer.
図から、予測精度は期間が長くなるにつれて上がることがわかる。


This is because that the longer the period is, the more information we have and the higher
resistance of our prediction to noise.
これは期間が長くなるほど、我々のもつ情報は増え、ノイズに対する我々の予測の抵抗力も上がる。


At last, we can reach 85% accuracy when time spam gets longer than 30 days.
最後に、期間が30日よりも長くなると、85%の精度に到達できる。


Actually, we can re-paraphrase this problem as estimation of Pr{V_{t+1}-V_t>C_t}, where C_t=-(V_{t-t_s}-V_t).
実際、この問題はC_t=-(V_{t-t_s}-V_t)の元で、Pr{V_{t+1}-V_t>C_t}を評価するものとして言い換えることができる。


This corresponds to the after-mentioned regression problem of daily stock market movements.
これは後に言及する日々の株式市場動向の回帰問題に対応する。


3) Multi-Feature Prediction
3) 複数の特徴による予測


Using the features described in section 2, we compare the prediction accuracies of SVM algorithm
and MART (a decision tree based boosting algorithm).
節2で記述された特徴を使用して、SVMアルゴリズムの予測精度とMART(ブースティングアルゴリズムに基づく決定)の予測精度を比較する。


The prediction results are shown in Table 2.
その予測結果は表2に示される。


From Table 1, we can see that accuracies from SVM and MART learner can reach as high as 74%.
表1から、SVMとMARTによる学習器の精度は74%に到達しうる。


This daily trend prediction accuracy is higher than most of models and the values reported on financial analysis websites.
この日々の動向予測精度はほとんどのモデルよりも高く、値は金融分析ウェブサイトで報告された。


In addition, we note that SVM algorithm is very sensitive to the size of training data.
加えて、SVMアルゴリズムは訓練データの数に対して非常に敏感である。


When the size of training set is not large enough,
hyper-plane found by SVM algorithm might not be able to split the data properly.
訓練集合のサイズが十分に大きくない場合、SVMアルゴリズムによって発見される超平面はデータを適切に分割することができないかもしれない。


Thus, feature selection is essential when using SVM.
したがって、特徴選定はSVMを使用する場合に非常に重要である。


In contrast, Multiple Additive Regression Trees (MART) algorithm requires less training
data and prefers high dimensional feature set.
これに対して、MARTアルゴリズムはより少ない訓練データを必要とし高次元の特徴集合を好む。


To test the generality of our model, we used the same algorithm to predict the other two US stock markets.
我々のモデルの一般性を検証するために、ほかの2つの米国株式市場を予測するために同じアルゴリズムを使用した。


The results are shown in Table 3 below.
その結果が下記の表3に示される。


As can be seen, all entries in the table are high.
見てわかるように、表のすべてのエントリで高い。


This shows that our model can be applied to all US stock markets.
これは我々のモデルがすべての米国株式市場に適用できることを示す。


Actually, the idea of using time delay between different stock markets can be also utilized to predict other indexes.
実際、異なる株式市場間の時間差を使ったアイデアはほかの指標を予測するために利用されている。