Understanding and Resolving Hanging Issue in NeuralProphet Code Execution

53 Views Asked by At

I am currently facing a perplexing problem while running a Python code snippet using the NeuralProphet library. Specifically, I am encountering a hang or unresponsive state in my code execution. Despite my efforts, I cannot identify the root cause of this problem. I need assistance in understanding why this hang is occurring and how to resolve it.

Here is the code snippet I am working with:

m = NeuralProphet()
    m.set_plotting_backend("plotly")
    model = m.fit(data, freq='D', batch_size = 8 , epochs=10)
    future_month = 3
    last_date = data['ds'].max()
    future_dates = pd.date_range(start=last_date, periods=future_month + 1, freq='M')[1:]
    future_period = (future_dates[2] - last_date).days
    future = m.make_future_dataframe(data, n_historic_predictions=True, periods=future_period)
    forecast = m.predict(future)
    model_directory = 'model'
    if not os.path.exists(model_directory):os.makedirs(model_directory)
    model_file_path = os.path.join(model_directory, 'test.pkl')
    with open(model_file_path, "wb") as f:pickle.dump(m, f)
    
    f = io.BytesIO(m.plot(forecast).to_image(format="PNG"))

I have attempted to troubleshoot the issue myself but haven't had any success. Even when I use Ctrl+C to interrupt the execution, the code remains unresponsive.

To provide more context, I am using Python [3.9.18] and NeuralProphet version [0.6.2].

0

There are 0 best solutions below