Traceback (most recent call last):
File "/home/bra/miniconda3/envs/ccpred/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/bra/miniconda3/envs/ccpred/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/bra/ccpred/src/ccpred/__main__.py", line 19, in <module>
c(**kwargs)
File "/home/bra/ccpred/src/ccpred/test.py", line 91, in test
plots = m.plot_prediction_actual_by_variable(variables)
File "/home/bra/miniconda3/envs/ccpred/lib/python3.9/site-packages/pytorch_forecasting/models/base_model.py", line 1666, in plot_prediction_actual_by_variable
figs = {name: self.plot_prediction_actual_by_variable(data, name) for name in data["support"].keys()}
File "/home/bra/miniconda3/envs/ccpred/lib/python3.9/site-packages/pytorch_forecasting/models/base_model.py", line 1666, in <dictcomp>
figs = {name: self.plot_prediction_actual_by_variable(data, name) for name in data["support"].keys()}
File "/home/bra/miniconda3/envs/ccpred/lib/python3.9/site-packages/pytorch_forecasting/models/base_model.py", line 1718, in plot_prediction_actual_by_variable
x = scaler.inverse_transform(x.reshape(-1, 1)).reshape(-1)
AttributeError: 'NoneType' object has no attribute 'inverse_transform'
I worked around this issue by adding "None-Check" in base_model.py
Does not work:
if not isinstance(scaler, (GroupNormalizer, EncoderNormalizer)):
x = scaler.inverse_transform(x.reshape(-1, 1)).reshape(-1)
ax.set_xlabel(f"Normalized {name}")
Works:
if not isinstance(scaler, (GroupNormalizer, EncoderNormalizer)):
if scaler is not None:
x = scaler.inverse_transform(x.reshape(-1, 1)).reshape(-1)
ax.set_xlabel(f"Normalized {name}")
Expected behavior
I executed code like in the tutorial Demand forecasting with the Temporal Fusion Transformer -> Actuals vs predictions by variables
with None-scalers for several variables
Actual behavior
However, result was
I worked around this issue by adding "None-Check" in base_model.py Does not work:
Works:
Maybe I am doing something wrong?