時系列の種類と応用

Pythonで学ぶMachine Learningによる時系列データ解析

Chris Holdgraf

Fellow, Berkeley Institute for Data Science

時系列

Pythonで学ぶMachine Learningによる時系列データ解析

時系列

Pythonで学ぶMachine Learningによる時系列データ解析

時系列とは何か?

データポイント データポイント データポイント データポイント データポイント データポイント
1 34 12 54 76 40

時点 時点 時点 時点 時点 時点
2:00 2:01 2:02 2:03 2:04 2:05

時点 時点 時点 時点 時点 時点
1月 2月 3月 4月 5月 6月

時点 時点 時点 時点 時点 時点
1e-9 2e-9 3e-9 4e-9 5e-9 6e-9

Pythonで学ぶMachine Learningによる時系列データ解析

Pandasで時系列を読み込む

import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv('data.csv')
data.head()
          date symbol       close       volume
0   2010-01-04   AAPL  214.009998  123432400.0
46  2010-01-05   AAPL  214.379993  150476200.0
92  2010-01-06   AAPL  210.969995  138040000.0
138 2010-01-07   AAPL  210.580000  119282800.0
184 2010-01-08   AAPL  211.980005  111902700.0
Pythonで学ぶMachine Learningによる時系列データ解析

pandas時系列のプロット

import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(12, 6))
data.plot('date', 'close', ax=ax)
ax.set(title="AAPL daily closing price")
Pythonで学ぶMachine Learningによる時系列データ解析

時系列グラフ

Pythonで学ぶMachine Learningによる時系列データ解析

なぜ機械学習を使うのか?

非常に大量かつ複雑なデータを扱えます

Pythonで学ぶMachine Learningによる時系列データ解析

なぜ機械学習を使うのか?

できること...

  • 将来の予測
  • 処理の自動化

Pythonで学ぶMachine Learningによる時系列データ解析

なぜ両者を組み合わせるのか?

Pythonで学ぶMachine Learningによる時系列データ解析

機械学習パイプライン

  • 特徴量抽出
  • モデルの学習
  • 予測と検証
Pythonで学ぶMachine Learningによる時系列データ解析

では、練習しましょう!

Pythonで学ぶMachine Learningによる時系列データ解析

Preparing Video For Download...