Skip to content

Can't cycle prediction be made? #1355

Description

@zhizhuaa

What happened + What you expected to happen

When I have trained a model, I cannot make cyclic predictions. How can I implement the loop prediction of the trained model rows? It's impossible to call nf.cross_validation(), conduct real-time training each time and then make predictions, right?

Image

Versions / Dependencies

Image

Reproduction script

        merged_df['unique_id'] = 1
        merged_df = merged_df.loc[:, ['y', 'ds'] + list(merged_df.columns[4:])]
        train_df = merged_df[merged_df['ds'] < eval_start]
        val_df = merged_df[(merged_df['ds'] >= val_start) & (merged_df['ds'] < val_end)]
        test_df = merged_df[(merged_df['ds'] >= eval_start) & (merged_df['ds'] < eval_end)]
        folder_path = folder_path + 'deep/'
        models = [LSTM(input_size=96, 
                       h=1, 
                       scaler_type='standard',
                       max_steps=200,
                       val_check_steps=10,
                       early_stop_patience_steps=3,
                       futr_exog_list=[col for col in merged_df.columns if col not in ['unique_id','ds','y']]
                      )]
        nf = NeuralForecast(models=models, freq='15min')
        file_name ='configuration.pkl'
        if os.path.exists(folder_path+file_name):
            nf = NeuralForecast.load(path=folder_path)
        else:
            nf.fit(df=train_df, val_size=len(val_df))
            nf.save(path=folder_path,
                    model_index=None,
                    overwrite=True,
                    save_dataset=True)
        # cv_df_val_test = nf.cross_validation(merged_df, val_size=len(val_df), test_size=len(test_df), n_windows=None)
        results = []
        for index, row in test_df.iterrows():
            futr_df = pd.DataFrame([row])
            Y_hat_df = nf.predict(futr_df=futr_df)
            results.append(Y_hat_df)
        final_results = pd.concat(results, ignore_index=True)

Issue Severity

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions