[Python] How to fix overly smooth LSTM forecasts in volatility time series prediction?

Discussão em 'Python' iniciado por Stack, Julho 6, 2025.

  1. Stack

    Stack Membro Participativo

    I'm facing an issue with forecasting volatility using LSTM and Gridsearch for find the best Hyperparameter for model.

    param_grid = {
    'units': [32, 64, 128],
    'dropout': [0.2, 0.5],
    'batch_size': [32, 64],
    'epochs': [50, 100],
    'learning_rate': [0.001, 0.0005]
    }


    here is the training model build

    model = Sequential()
    model.add(Input(shape=(X_train.shape[1], X_train.shape[2])))
    model.add(LSTM(params['units']))
    model.add(Dropout(params['dropout']))
    model.add(Dense(1, activation='linear'))

    optimizer = Adam(learning_rate=params['learning_rate'])
    model.compile(loss='mse', optimizer=optimizer)

    early_stop = EarlyStopping(monitor='val_loss', patience=10, restore_best_weights=True)

    history = model.fit(
    X_train, y_train,
    epochs=params['epochs'],
    batch_size=params['batch_size'],
    validation_split=0.1,
    callbacks=[early_stop],
    verbose=0,
    shuffle=False
    )


    I trained an LSTM model to predict financial instrument volatility (generated from a GARCH model). The evaluation metrics on the test set are quite good:

    MAE: 0.0251
    RMSE: 0.0406
    R²: 0.8069
    MAPE: 8.22%
    Directional Accuracy: 0.5445


    [​IMG] here is the result of comparison on the actual and predicted data for a month ago, blue is actual and red is preddict

    The predictions on the test data look quite accurate when compared to the actual values, but Directional Accuracy are poor results. However, when I perform multi-step forecasting, the predicted values become overly smooth, lacking the realistic fluctuations that I would expect. [​IMG]

    My questions:


    What are the common causes for overly smooth LSTM forecasts in time series prediction?

    Could the relatively low Directional Accuracy (around 54%) be a contributing factor?

    How can I improve this issue?
    ​

    Additional Information:


    Input features: Log_Return, Residual, Volume, PC1, and PC2 (PC1 and PC2 are the result of PCA applied to 7 technical indicators) Target : Garch_Volatility
    ​

    Libraries used: scikit-learn and TensorFlow Keras

    Continue reading...

Compartilhe esta Página