[Python] How to unscale data after predictions?

Discussão em 'Python' iniciado por Stack, Março 14, 2025.

  1. Stack

    Stack Membro Participativo

    I have a dataset with 2 features (price & volume) & 1 predicted variable (price) and use LTSM model to predict next price based on the previous set of prices.

    First I scale the dataset:

    #Scale the data
    scaler = MinMaxScaler(feature_range=(0,1))
    scaled_data = scaler.fit_transform(dataset)


    Finally I want to unscale it:

    #Get the models predicted price values
    predictions = model.predict(x_test)
    predictions = scaler.inverse_transform(predictions)


    But this doesn't work and I get this error:

    ValueError: non-broadcastable output operand with shape (400,1) doesn't match the broadcast shape (400,2)

    Continue reading...

Compartilhe esta Página