深層学習による解釈された預言者モデルの改善
こんにちは、Khabrovites。オンラインコース「MachineLearning。Advanced」の学生募集の一環として、資料の翻訳を用意しました。
オープンデモレッスン「クラスタリング時系列」にぜひご参加ください。時系列に結びつく興味深いタスクです。
•証券取引所のダイナミクスで互いに類似した金融資産を見つけることは可能ですか?
•ユーザーの行動に応じてユーザーをグループ化する方法は?
•ロジャー・ラビットを額装したのは誰ですか?
これらの質問のいくつかに対する回答は、オンラインレッスンで取得します。参加しませんか!
, Prophet, Facebook. , , , , (, ) . , .
, , — NeuralProphet. , Prophet , . , , , Prophet.
, NeuralProphet
. , , . , , . !
NeuralProphet
, NeuralProphet
, , .
, — , , . , - . , , .
Prophet . , , — . — — , . Prophet , :
Prophet — ..
— ,
— . , , . , ( ) . , , .. , . . , :
, ( ), , .
, , ,
, , ( )
, Prophet , , . NeuralProphet
— Prophet, (PyTorch Stan) (AR-Net), . AR-Net , , , , .
NeuralProphet Prophet
NeuralProphet
PyTorch,
.
.
,
( 1).
.
, , -. , , Prophet , , .
, NeuralProphet
— , pip install.
. . .
, Python.
import pandas as pd
from fbprophet import Prophet
from neuralprophet import NeuralProphet
from sklearn.metrics import mean_squared_error
# plotting
import matplotlib.pyplot as plt
# settings
plt.style.use('seaborn')
plt.rcParams["figure.figsize"] = (16, 8)
neural_prophet_1.py hosted with ❤ by GitHub
Peyton Manning ( ). , , , , Prophet. — .
Facebook, , Prophet, Prophet, NeuralProphet
.
, :
# loading the dataset
df = pd.read_csv('../neural_prophet/example_data/wp_log_peyton_manning.csv')
print(f'The dataset contains {len(df)} observations.')
df.head()
neural_prophet_2.py hosted with ❤ by GitHub
, Prophet, : ds
— /, y
— , . , , .
, . , , . , , .
df.plot(x='ds', y='y', title='Log daily page views');
# getting the train/test split
test_length = 365
df_train = df.iloc[:-test_length]
df_test = df.iloc[-test_length:]
neural_prophet_3.py hosted with ❤ by GitHub
Prophet
, Prophet . 4 . . , . , . , «future dataframe». , . . , ( ). , preds_df_1
.
prophet_model = Prophet() prophet_model.fit(df_train) future_df = prophet_model.make_future_dataframe(periods=test_length) preds_df_1 = prophet_model.predict(future_df)
neural_prophet_4.py hosted with ❤ by GitHub
, ( ).
, . .
. .
prophet_model.plot_components(preds_df_1);
.
NeuralProphet
, API NeuralProphet
Prophet. , , , NeuralProphet
.
nprophet_model = NeuralProphet()
metrics = nprophet_model.fit(df_train, freq="D")
future_df = nprophet_model.make_future_dataframe(df_train,
periods = test_length,
n_historic_predictions=len(df_train))
preds_df_2 = nprophet_model.predict(future_df)
neural_prophet_5.py hosted with ❤ by GitHub
, . ( Prophet ) , «future dataframe». , .
, , .
nprophet_model.plot(preds_df_2);
. ( , preds_df_2
, preds_df_1
, , , !), .
nprophet_model.plot_components(preds_df_2, residuals=True);
, .
nprophet_model.plot_parameters();
, , plot_components ( ).
, . DataFrame
, (MSE).
# prepping the DataFrame
df_test['prophet'] = preds_df_1.iloc[-test_length:].loc[:, 'yhat']
df_test['neural_prophet'] = preds_df_2.iloc[-test_length:].loc[:, 'yhat1']
df_test.set_index('ds', inplace=True)
print('MSE comparison ----')
print(f"Prophet:\t{mean_squared_error(df_test['y'], preds_df_1.iloc[-test_length:]['yhat']):.4f}")
print(f"NeuralProphet:\t{mean_squared_error(df_test['y'], preds_df_2.iloc[-test_length:]['yhat1']):.4f}")
df_test.plot(title='Forecast evaluation');
neural_prophet_6.py hosted with ❤ by GitHub
.
, , MSE — NeuralProphet
.
, , . , , , , , , . . . .
NeuralProphet
— ( -), . , . Prophet, , , , .
Prophet NeuralProphet
, , , . , !
, , GitHub. , . .