Train Phase
The goal of the training phase is to teach the model using historical data provided in an input data set or data source. This data set includes the time series of our target variable, which is the variable we want to predict, as well as the time series of all the other variables (features) that might influence the target variable.
In this phase, only the relevant features are selected. Then, different models are tested, and the one with the best accuracy is chosen.
The training phase consists of 4 steps:
- Pre-Process
- Feature Engineer
- Feature Selection
- Model Selection
Pre-Process Step¶
Each variable is analyzed to determine how well it can explain the other variables.
The analysis is done in pairs: how much variable A explains variable B, how much B explains A, how much A explains C, and so on for all pairs of variables. The selection process keeps:
- Independent variables, which are those not explained by other variables.

 - Dependent variables based on a specific threshold (which you can set in the parameters). If it is found that one variable explains another above a certain threshold, only one of the two is chosen (specifically, the one with the higher R-squared value—see the parameters section).

For example, the features in the input train data set/data source are:
- COVID_RATE
- PRICE
- MARKETING
- SALES_ST
- DISCOUNT_P
- CUST_SATISF
- QUAL_INDEX
- MARKET_VOL
While VOLUME is the target variable.
The graph detection dependency algorithm runs for all features and eliminates CUST_SATISF because it is dependent from:
- PRICE
- DISCOUNT_P
- QUAL_INDEX
Feature Engineer Step¶
Predictive Planning calculates the seasonality for each target variable and feature and creates new features shifting the original one from 1 to the seasonality of that feature (if the Use Target Feature Seasonality parameter is Y).
For example, Predictive Planning computes the seasonality of the target variable that is 12, and the software computes the seasonality for each feature:
- COVID_RATE (LAG -6)
- PRICE (LAG -12)
- MARKETING (LAG -6)
- SALES_ST (LAG -12)
- DISCOUNT_P (LAG –6)
- CUST_SATISF (LAG –12)
- QUAL_INDEX (LAG –12)
- MARKET_VOL (LAG -12)
Predictive Planning then calculates the shift up to the value set in the Feature max lag parameter:
| Features | Ref_Date | Amount |
|---|---|---|
| COVID_RATE | 2024.02 | 0,20 |
| COVID_RATE (LAG -1) | 2024.02 | 0,15 |
| COVID_RATE (LAG -2) | 2024.02 | 0,01 |
| MARKETING | 2024.02 | -141000 |
| MARKETING (LAG -1) | 2024.02 | -166300 |
| MARKETING (LAG -2) | 2024.02 | -165000 |
Feature Selection Step¶
Predictive Planning performs the feature selection using the Boruta algorithm (if the Perform Features Selection parameter is Y).
For example, the Boruta algorithm selects three features for predicting the variable VOLUME:
- COVID_RATE
- MARKETING-2
- DISCOUNT_P




Model Selection Step¶
All models in the Model List parameters are applied to train the data during the Model Selection step. The default value in the parameter is the list of all methods:
- AdaBoost
- ElasticNetReg
- DecisionTree
- GradientBoosting
- LinearRegressor
- RidgeRegressor
- LassoRegressor
- SGDRegressor
- KNeighbors
- SupportVector
- ExtraTreesReg
- RandomForestReg
- Sarimax
- HoltWinters
- LightGBM
This step calculates the fit on the training data, the feature importance, and the metric to optimize. The default metric in the parameter is MAPE (mean absolute percentage error), but the options are:
- MAPE (mean_absolute_percentage_error)
- MGD (mean_gamma_deviance)
- MPD (mean_poisson_deviance)
- R2 (r2)
- MEAE (median_absolute_error)
- MSLE (mean_squared_log_error)
- MSE (mean_squared_error)
- MAE (mean_absolute_error)
- ME (max_error)
- E_VARIANCE (explained_variance)
Then the model with the best metric score is selected.
Finally, for each target variable, Predictive Planning returns the feature importance, the method with the metric score, the fit of the training data, and the contribution of each variable to achieve the target variable inthe different data sets. For example, all the models in the following list are applied to train the data and calculate the MAPE:
- AdaBoost Regressor; MAPE = 12%
- Decision Tree Regressor; MAPE = 15%
- Elastic Net Regressor; MAPE = 7%
- Extra Trees Regressor; MAPE = 14%
- Grandient Boost Regressor; MAPE = 5%
- Linear Regressor; MAPE = 8%
- Ridge Regressor; MAPE = 12%
- Sarimax; MAPE = 3%
- SDG Regressor; MAPE = 11%
- Random Forest Regressor; MAPE = 10%
- Holt-Winters; MAPE = 7%
- Light GBM; MAPE = 6%
- LassoRegressor; MAPE = 11%
- KNeighbors; MAPE = 8%
- SupportVector; MAPE = 12%
Predictive Planning selects the Sarimax method with MAPE = 3%.
The information is saved to be reused during the training phase.
Predictive Planning calculates the contribution to achieving the target variable using an “explainability” technique like “shapely” values for each variable.
Predictive Planning returns the feature importance, the method with MAPE, the training data fit, and each variable’s contribution to achieving the target variable in the different data sets.