Verbesserung eines interpretierten Prophetenmodells durch tiefes Lernen
Hallo, Chabrowiten. Im Rahmen der Rekrutierung von Studenten fĂŒr den Online-Kurs " Maschinelles Lernen. Fortgeschritten " haben wir eine Ăbersetzung des Materials vorbereitet.
Wir laden alle ein, an der offenen Demo-Lektion "Clustering Time Series" teilzunehmen : eine interessante Aufgabe, die mit Zeitreihen verknĂŒpft werden kann.
⹠Ist es möglich, an der Börse Àhnliche finanzielle Vermögenswerte in ihrer Dynamik zu finden?
âą Wie gruppieren Sie Benutzer nach ihrem Verhalten?
âą Wer hat Roger Rabbit gerahmt?
Wir werden Antworten auf einige dieser Fragen in einer Online-Lektion erhalten. Begleiten Sie uns!
, Prophet, Facebook. , , , , (, ) . , .
, , â NeuralProphet. , Prophet , . , , , Prophet.
, NeuralProphet
. , , . , , . !
NeuralProphet
, NeuralProphet
, , .
â , . , ( ), , . X, . , , , .
, â , , . ââ , - . , , .
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. , . .