Lineare Modellierung mit Finanzdaten

Maschinelles Lernen für Finanzen in Python

Nathan George

Data Science Professor

Train-/Test-Plot

Maschinelles Lernen für Finanzen in Python

Train- und Testsets erstellen

import statsmodels.api as sm

linear_features = sm.add_constant(features)
train_size = int(0.85 * targets.shape[0])
train_features = linear_features[:train_size] train_targets = targets[:train_size] test_features = linear_features[train_size:] test_targets = targets[train_size:]
some_list[start:stop:step]
Maschinelles Lernen für Finanzen in Python

Lineare Modellierung

model = sm.OLS(train_targets, train_features)

results = model.fit()
Maschinelles Lernen für Finanzen in Python

Lineare Modellierung

print(results.summary())
Maschinelles Lernen für Finanzen in Python
Dep. Variable:         10d_future_pct   R-squared:                  0.157
Model:                            OLS   Adj. R-squared:             0.146
Method:                 Least Squares   F-statistic:                15.55
Date:                Thu, 19 Apr 2018   Prob (F-statistic):         4.79e-14
Time:                        11:41:05   Log-Likelihood:             336.53
No. Observations:                 425   AIC:                       -661.1
Df Residuals:                     419   BIC:                       -636.8
Df Model:                           5                                         
Covariance Type:            nonrobust                                         
===========================================================================
                  coef    std err        t      P>|t|     [0.025     0.975]
<hr />-------------------------------------------------------------------------
const           1.3305      0.323    4.117      0.000      0.695      1.966
10d_close_pct   0.0906      0.098    0.927      0.355     -0.102      0.283
ma14            0.3313      0.209    1.585      0.114     -0.080      0.742
rsi14          -0.0013      0.001   -1.044      0.297     -0.004      0.001
ma200          -0.4090      0.053   -7.712      0.000     -0.513     -0.305
rsi200         -0.0224      0.003   -6.610      0.000     -0.029     -0.016
===========================================================================
Omnibus:                      3.571   Durbin-Watson:              0.209
Prob(Omnibus):                0.168   Jarque-Bera (JB):           3.323
Skew:                         0.202   Prob(JB):                   0.190
Kurtosis:                     3.159   Cond. No.                   5.47e+03
Maschinelles Lernen für Finanzen in Python

p-Werte

print(results.pvalues)
const            4.630428e-05
10d_close_pct    3.546748e-01
ma14             1.136941e-01
rsi14            2.968699e-01
ma200            9.126405e-14
rsi200           1.169324e-10
Maschinelles Lernen für Finanzen in Python

Ist vs. Ist

Maschinelles Lernen für Finanzen in Python

Prognosen vs. Ist

Maschinelles Lernen für Finanzen in Python

Zeit für ein lineares Modell!

Maschinelles Lernen für Finanzen in Python

Preparing Video For Download...