neural_prophet icon indicating copy to clipboard operation
neural_prophet copied to clipboard

assert n_data >= 1 assertion fails with monthly data

Open hancelpv opened this issue 2 years ago • 0 comments

Are there any minimum data requirements for this to work with monthly data ? I'm attaching a reproducible example below in which it fails when I'm trying to train a model with monthly data.

Parameter Values: train size = 24 time series frequency = Monthly forecast_horizon = 24 lags_to_use = 3

Please let me know if there are any minimum data requirements, I could find only one example with daily data in the documentation.

#!pip install neuralprophet

import pandas as pd
import numpy as np
from neuralprophet import NeuralProphet

# some configurables
start_date = '2016-01-01'
time_series_length = 24
seasonal_periods = 12

# create random number dataframe
df = pd.DataFrame({
    'ds':pd.date_range(start=start_date, periods=time_series_length),
    'y': np.random.randint(0, high=100, size=time_series_length)
})

nnet_ar = NeuralProphet(
            n_forecasts=24,
            n_lags=int(seasonal_periods // 4),
            num_hidden_layers=1,
            epochs=1,
            yearly_seasonality="auto",
            weekly_seasonality="auto",
            daily_seasonality="auto"
        )

nnet_ar.fit(df)

Running the above code results in assertion error, attaching screenshot image

hancelpv avatar Jul 12 '22 10:07 hancelpv