Datatransformaties, features en targets

Machine Learning voor finance in Python

Nathan George

Data Science Professor

Features en targets maken

features = amd_df[['10d_close_pct', 'Adj_Volume']]

targets = amd_df['10d_future_close_pct']
print(type(features))
pandas.core.series.DataFrame
print(type(targets))
pandas.core.series.Series
Machine Learning voor finance in Python

koers en voortschrijdend gemiddelde

Machine Learning voor finance in Python

Voortschrijdende gemiddelden

Voortschrijdende gemiddelden:

  • gebruik n voorgaande dagen voor het gemiddelde
  • gangbare waarden voor n: 14, 50, 200
Machine Learning voor finance in Python

koers en sma

Machine Learning voor finance in Python

RSI en koersgrafiek

Machine Learning voor finance in Python

RSI-vergelijking

RS-vergelijking

Machine Learning voor finance in Python

SMA en RSI berekenen

import talib

amd_df['ma200'] = talib.SMA(amd_df['Adj_Close'].values, timeperiod=200)
amd_df['rsi200'] = talib.RSI(amd_df['Adj_Close'].values, timeperiod=200)
Machine Learning voor finance in Python

Eindelijk: onze features

feature_names = ['10d_close_pct', 'ma200', 'rsi200']
features = amd_df[feature_names]
targets = amd_df['10d_future_close_pct']

feature_target_df = amd_df[feature_names + '10d_future_close_pct']
Machine Learning voor finance in Python

Correlaties checken

import seaborn as sns

corr = feature_target_df.corr()
sns.heatmap(corr, annot=True)
Machine Learning voor finance in Python

correlatieplot van feature en target

Machine Learning voor finance in Python

Laten we features en targets maken!

Machine Learning voor finance in Python

Preparing Video For Download...