Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix fallback strategy #548

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MartinoMensio
Copy link
Contributor

@MartinoMensio MartinoMensio commented Sep 2, 2024

"index" column does not exist. Reference the index from forecast dataframe

Trace:

KeyError                                  Traceback (most recent call last)
/tmp/ipykernel_68905/1675210467.py in ?()
      1 # TODO: check why values of past and future do not match (very different values)
      2 
      3 
----> 4 forecast = model.predict(historic_df=df_hist, prediction_df=weather_forecast_standardized, house_id=house_id)

~/code/energy-forecast/load-forecasting/demand_forecasting/forecast/model.py in ?(self, historic_df, prediction_df, house_id, known_ground_truth)
    183         id_full = f"{self.experiment_id_base}_{house_id}"
    184         pj = PredictionJobDataClass(id=id_full, **self.pj)
    185 
    186         # Make a forecast
--> 187         forecast = create_forecast_pipeline(
    188             pj,
    189             df,
    190             mlflow_tracking_uri=f"{utils.MODELS_PATH}/models/",  # {self.datetime_value}",

~/.cache/pypoetry/virtualenvs/load-forecasting-8OKFhNKY-py3.10/lib/python3.10/site-packages/openstef/pipeline/create_forecast.py in ?(pj, input_data, mlflow_tracking_uri)
     57     # Load most recent model for the given pid
     58     model, model_specs = MLflowSerializer(
     59         mlflow_tracking_uri=mlflow_tracking_uri
     60     ).load_model(experiment_name=str(prediction_model_pid))
---> 61     return create_forecast_pipeline_core(pj, input_data, model, model_specs)

~/.cache/pypoetry/virtualenvs/load-forecasting-8OKFhNKY-py3.10/lib/python3.10/site-packages/openstef/pipeline/create_forecast.py in ?(pj, input_data, model, model_specs)
    143             forecast_type="fallback",
    144             pid=pj["id"],
    145             fallback_strategy=fallback_strategy,
    146         )
--> 147         forecast = generate_fallback(data_with_features, input_data[["load"]])
    148 
    149     else:
    150         # Predict

~/.cache/pypoetry/virtualenvs/load-forecasting-8OKFhNKY-py3.10/lib/python3.10/site-packages/openstef/model/fallback.py in ?(forecast_input, load, fallback_strategy)
     64             forecast.reset_index()
     65             .merge(
     66                 highest_daily_loadprofile, left_on="time", right_on="time", how="outer"
     67             )
---> 68             .set_index("index")
     69         )
     70 
     71     # Rename so column is called forecast

~/.cache/pypoetry/virtualenvs/load-forecasting-8OKFhNKY-py3.10/lib/python3.10/site-packages/pandas/core/frame.py in ?(self, keys, drop, append, inplace, verify_integrity)
   6118                     if not found:
   6119                         missing.append(col)
   6120 
   6121         if missing:
-> 6122             raise KeyError(f"None of {missing} are in the columns")
   6123 
   6124         if inplace:
   6125             frame = self

KeyError: "None of ['index'] are in the columns"

MartinoMensio and others added 2 commits September 2, 2024 18:58
"index" column does not exist. Reference the index from forecast dataframe

Signed-off-by: Martino Mensio <[email protected]>
Signed-off-by: Clara De Smet <[email protected]>
@clara-de-smet
Copy link
Collaborator

@MartinoMensio We fixed an issue in the build that caused PR pipelines to fail, so I updated your branch to retry the building step. Sorry for the delay!
I did notice that the tests are not succeeding though, so you may want to take another look at the changes you made.

Signed-off-by: Clara De Smet <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants