季節性

Python 中級預測分析

Nele Verbiest

Senior Data Scientist @PythonPredictions

季節效應(1)

Python 中級預測分析

季節效應(2)

平均捐款次數

Python 中級預測分析

季節效應(3)

平均捐款金額

Python 中級預測分析

季節性與時間軸(1)

Python 中級預測分析

季節性與時間軸(2)

Python 中級預測分析

季節性與時間軸(3)

Python 中級預測分析

處理季節性

  • 檢查季節性
gifts.groupby("month")["amount"].mean()
gifts.groupby("month").size()
  • 在歷史中使用合適的時間軸

Python 中級預測分析

季節性與預測模型

模型時間軸:2018 年 5 月

logreg = linear_model.LogisticRegression()
logreg.fit(X_may2018, y_may2018)

predictions = logreg.predict_proba(X_jan2019)[:,1] auc = roc_auc_score(y_jan2019, predictions) print(round(auc,2))
0.53

模型時間軸:2018 年 1 月

logreg = linear_model.LogisticRegression()
logreg.fit(X_jan2018, y_jan2018)

predictions = logreg.predict_proba(X_jan2019)[:,1] auc = roc_auc_score(y_jan2019, predictions) print(round(auc,2))
0.56
Python 中級預測分析

一起來練習吧!

Python 中級預測分析

Preparing Video For Download...