Facebook Prophet + Deep Learning = NeuralProphet

Mejora de un modelo de Profeta interpretado con aprendizaje profundo

Hola, Khabrovites. Como parte de la captación de alumnos para el curso online " Machine Learning. Avanzado ", preparamos una traducción del material.



Invitamos a todos a participar en la lección de demostración abierta "Clustering Time Series" : una tarea interesante que se puede vincular a series de tiempo.

• ¿Es posible encontrar activos financieros similares entre sí en la dinámica de la bolsa de valores?

• ¿Cómo agrupar a los usuarios según su comportamiento?

• ¿Quién mató a Roger Rabbit?

Obtendremos respuestas a algunas de estas preguntas en una lección en línea. ¡Únete a nosotros!






, Prophet, Facebook. , , , , (, ) . , .





, , — NeuralProphet. , Prophet , . , , , Prophet.





, NeuralProphet



. , , . , , . !





NeuralProphet

, NeuralProphet



, , .





— , . , ( ), , . X, . , , , .





, — , , . ​​ , - . , , .









Prophet . , , — ​​ . — — , . Prophet , :





  • Prophet — ..









  • — ,





. , , . , ( ) . , , .. , . . , :





  • , ( ), , .





  • , , ,





  • , , ( )





, Prophet , , . NeuralProphet



— Prophet, (PyTorch Stan) (AR-Net), . AR-Net , , , , .





NeuralProphet Prophet

, NeuralProphet



, . , :





  • 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. , . .





:

  • Neural Prophet





  • Facebook Prophet





  • AR-Net






"Machine Learning. Advanced"





« »








All Articles