0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

kaggle tutorial time series part4

Posted at

の確認をおこなっていきます。
trend+XGBoost(相互作用の学習)を組み合わせた「ハイブリッド」予測モデルを考えていきます。

series = trend + seasons + cycles + error

という関係を考えます。
ここで、
季節性(Seasonality)

  • 固定された一定の期間で繰り返すパターン
  • 例:1年周期、1日周期など

サイクル(Cycles)

  • 不規則な期間で変動するパターン
  • 周期が一定ではない

と違いが有ります。

trendの誤差分をseasonsで補正、seasonsでも残る誤差分をcyclesで、cyclesでも残る誤差はerrorという風に捉える事で近似出来ます。

どのようにそれをcodeにするかという関係を考えていきます。

# 1. 最初のモデルで訓練と予測を行う
model_1.fit(X_train_1, y_train)
y_pred_1 = model_1.predict(X_train)

# 2. 残差に対して二つ目のモデルで訓練と予測を行う
model_2.fit(X_train_2, y_train - y_pred_1)
y_pred_2 = model_2.predict(X_train_2)

# 3. 全体の予測値を得るために足し合わせる
y_pred = y_pred_1 + y_pred_2

という形がわかりやすいですね。

その後は説明パートです。
理論をもとに、実際の例(売上の予測)です。
実際の例では、2つのモデル(trend+月ごとのXGBoost)の複合でデータを捉えようとしています。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?