I'm having an issue with the function `forecast_fi...
# mlforecast
I'm having an issue with the function
. It works as expected when there is no transformation (I've used the built-in
and also logged the y (which I can exponentiate later). Both of those approaches also work fine with
. However, when I do the below...
Copy code
import pandas as pd
from datasetsforecast.m3 import M3
import mlforecast
from mlforecast import MLForecast
from mlforecast.target_transforms import Differences, LocalStandardScaler
from mlforecast.utils import PredictionIntervals

import numpy as np
from numba import njit

import lightgbm as lgb
import xgboost as xgb

from window_ops.expanding import expanding_mean
from window_ops.ewm import ewm_mean
from window_ops.rolling import rolling_mean, seasonal_rolling_mean,rolling_min, rolling_max, rolling_std

Y_df, *_ = M3.load('./data', group='Yearly')
Y_df['y'] = np.log(Y_df['y']) #toggle on/off depending on which option I'm using

ML_models = [
         lgb.LGBMRegressor(n_jobs=6, random_state=0, verbosity=-1),
          xgb.XGBRegressor(n_jobs=6, random_state=0, eta=0.35)

mlf = MLForecast(
    models = ML_models,
    freq = 'M',
    lags=range(1, 3),
    target_transforms=[Differences([1,3])], LocalStandardScaler(), #toggle between having standardscaler and not depending on if I log y myself

forecasts_ml_df = mlf.fit(df=Y_df, fitted=True)
forecasts_ml_df_fits = forecasts_ml_df.forecast_fitted_values()
the resulting predictions appear to still be scaled. Interestingly, when log the y myself (removing the LocalStandardScaler) I still get odd values that look scaled somehow. If I don't use the localStandardScaler or logging the values make sense (don't look scaled). Any ideas what might be causing this?
FYI: this happens with other algos from sklear too, just abbreviated for the example here. Also, happens on other data. Just made an example here with M3 data.
After posting this I recalled seeing another thread related to mlforecast forecast_fitted_values. Following the advice in that thread, I upgraded from version 0.9.2 to 0.10.0 and that fixed the issue for me. Please disregard the post.
👍 1