データ変換、特徴量、目的変数

Python による金融のための Machine Learning

Nathan George

Data Science Professor

特徴量と目的変数の作成

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
Python による金融のための Machine Learning

価格と移動平均

Python による金融のための Machine Learning

移動平均

移動平均:

  • 過去 n 日間の平均を使用
  • n の代表値:14、50、200
Python による金融のための Machine Learning

価格と単純移動平均

Python による金融のための Machine Learning

RSIと価格のプロット

Python による金融のための Machine Learning

RSI方程式

RS方程式

Python による金融のための Machine Learning

SMAとRSIの計算

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)
Python による金融のための Machine Learning

特徴量の確定

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']
Python による金融のための Machine Learning

相関の確認

import seaborn as sns

corr = feature_target_df.corr()
sns.heatmap(corr, annot=True)
Python による金融のための Machine Learning

特徴量と目的変数の相関プロット

Python による金融のための Machine Learning

特徴量と目的変数を作成しましょう!

Python による金融のための Machine Learning

Preparing Video For Download...