Closed obiii closed 4 months ago
Hey @obiii, thanks for using mlforecast. The inverse transformation is applied to the predictions, not to the target, that's why we iterate over the columns that aren't the id, time or transformation stats here. So your inverse transformation should be something like this:
def inverse_transform(self, df: pd.DataFrame) -> pd.DataFrame:
df = df.copy(deep=False)
for col in df.columns.drop([self.id_col, self.time_col]):
df[col] = np.expm1(df[col])
return df
That being said, if you're using a transformation that doesn't learn any parameters like the log here, you're better off using the GlobalSklearnTransformer (example).
Please let us know if you have further doubts.
Hi,
Thanks for the clarification.
What happened + What you expected to happen
I am trying to do Log (log1p) transformation on the target column. The above code works and gives me the plot.
But the same does work when performing cross-validation:
gives the following trace:![image](https://github.com/Nixtla/mlforecast/assets/17766651/42ea7d17-0979-43fb-9e14-cbadfe4fb18b)
The code works if I remove the target_transforms from MLForecast.
Versions / Dependencies
Python: 3.9 MLForecast: 0.11.2
Reproduction script
Attached above.
Issue Severity
High: It blocks me from completing my task.