Let's say I'm trying to build a time series model with the following dataset:
import pandas as pd
import numpy as np
np.random.seed(2021)
dates = pd.date_range(start='2020-01-01', end='2021-12-01', freq='MS')
df = pd.DataFrame(np.random.uniform(-1, 1, size=(24, 4)), index=dates, columns=['A_values', 'B_values', 'C_values', 'target'])
df
Out:
A_values B_values C_values target
2020-01-01 0.211957 0.466739 -0.722106 -0.374654
2020-02-01 0.994487 -0.743675 -0.642014 0.505851
2020-03-01 0.324321 0.568620 -0.806211 -0.882857
......
2021-10-01 0.940398 -0.168986 -0.339022 0.933428
2021-11-01 0.651798 -0.389200 0.646556 0.113821
2021-12-01 0.437002 0.759874 -0.007980 0.024173
Suppose I will use A_values (which is actual values of a variable), B_values
(which is month over month percent change of a variable), C_values
(which is year over year percent change of a variable) to forecast target
column (which is year over year percent change of one variable).
Now my question is should I convert A_values
and B_values
to year over year percent change to coordinate with the target column's type? If I don't do that, will it lower the prediction accuracy?
In other words, could the machine learning algorithm such as XGBoost capture the relationship between MoM pct change and YoY pct change?
Note: it's easy to convert the actual value to YoY pct change, meanwhile we lose accuracy as converting from MoM to YoY.