Business User Reference (Optimization - Multifactor Elasticity)

To run the Multifactor Elasticity Accelerator, you need to create a new Model Object from the Optimization > Models menu, using the Multifactor Elasticity logic to instantiate the machine learning model and give it the required parameters. The model will then be added to the list and will be editable.

New Model

  1. Go to Optimization > Models and add a new model.

    Button to add a model

     

  2. Define the name of the model and choose Multifactor Elasticity as Model Class.

    Create a model

     

  3. The new model opens. It is based on the data you defined when deploying the Accelerator.

  4. When a new model is opened for the first time, it will run a small calculation to generate a parameters table used for some configuration. This will only happen once.

The resulting interface is shown below. The steps of the model are: Definition, Additional Sources, Model Training, and Model Predictions and they will be explained in the next section.

Definition Step

This step aims to define the input data and their mapping. You can also apply a filter to your data. There are two tabs:

  • Definition defines the historical data and the scope of the forecast.

  • Model Configuration defines the settings of the model.

Definition Tab

In this tab, you define the data source (typically a transaction source, see Data Requirements (Optimization - Multifactor Elasticity)) and map it, as well as choose the aggregation. Some general recommendations are:

  • There are checkboxes at the bottom of the tab for automatic filtering of negative quantities and prices, it is recommended to keep these checked.

  • The Shelf price will be converted to the weighted average unit price prior to Model Training.

  • If the List Price is set, values will be used to calculate the discountPct from the Shelf Price and store it as part of the model training features in the processed_data table. The discountPct values will be automatically updated over the price range of the elasticity calculation, leading to more accurate predictions.

  • There is a checkbox to perform a log transformation of the quantity. This may help in some cases to produce a better forecast (for example, in cases where sales are heavily skewed towards low values – i.e., there are many long-tail products present in the data).

  • The Time period field defines the level of aggregation for the forecast – daily, weekly or monthly.

  • The forecast generated in the final step may be extended up to 15 future time periods (e.g. 15 weeks for a weekly forecast).

  • Additional categorical and numerical features may optionally be added to the model from the source to improve the forecast.

    • Examples to include in the categorical features would be product hierarchies and product Pareto information. Categories should be unique for a given product and time period – fields such as channel and store should not be included here.

    • Numerical features may include any numerical attributes that can be averaged over the selected time period, such as discounts, stock levels or seasonal events. Values do not need to be unique – they will be averaged over the time period.

    • While numerical features can be included in the categorical features (for example, categories that use numerical codes), the same features should not be included in both categorical and numerical features at the same time. A warning will be displayed in this case.

Model Configuration Tab

In this tab, you may configure details of the forecasting model. The default values will work well in most cases for a weekly forecast. Some general recommendations are:

  • The test set size defines how many time periods are held back to estimate the model’s performance on data it has not seen before. It should be small compared to the number of time periods covered in the source (up to ~20%).

  • The number of past time steps for lags and differences and the rolling statistical window will help the model learn seasonal variation in the data. For example, for a weekly forecast, the default of 4 weeks will capture monthly variation. For a daily forecast it is recommended to increase these values to 30. For a monthly forecast, change to 3 (for quarterly variation) or 12 (for yearly variation) depending on data availability.

  • The elasticities produced in the results step will be split according to the historical fraction of sales in each store, the store fraction window length defines how many of the most recent time periods to consider when calculating this fraction.

  • The range of the elasticity prediction defines the price range of the elasticity curves calculated in the Model Predictions step. For example, a value of 50 will result in elasticity curves with a range of +/- 50% of the last known price for each product. This value is limited to +/- 100%. Note that predictions may be unreliable for ranges far outside of historical values.

  • You may choose to perform automatic tuning of the model’s internal parameters to improve the results. The default parameters will work in most cases but if run time is not a concern, increasing the number of tuning trials to 100 may provide small further improvements.

    • The tuning does not need to be run every time a model is calculated. If the model has been tuned before and the data has not changed significantly, you may deselect Perform automatic model tuning and select Use last known parameters from the buttons that appear to use the previously tuned parameters. If this option is selected before any tuning is done, default parameters will be used.

    • An advanced user may choose to apply their own configuration through choosing the Use parameters from parameters table option. The trainingParameters table, found in the parameters tables tab of the model tables may be edited according to the users' wishes.

    • The tuned parameters may be transferred to other models with a similar data scope to save time on tuning new models. Parameters can be exported from the model_parameters model table and imported into the trainingParameters parameter table. These parameters will then be used when choosing the Use parameters from parameters table option.

    • When working with very large datasets, the default parameters may result in poor model fits. Tuning a model with even a low number of trials will likely produce significantly better results in such cases.

Additional Sources Step

This step allows the user to define up to three additional sources that may optionally extend the Definition step source data or provide future values for the forecast. The available sources are:

  • Events Source – This source can be used to define business and calendar events. It should contain two fields: Date and Event names. The names of these fields are not strict. The source should have the following format:

    • A list of dates with events and the names of events occurring on those dates. A date can occur multiple times, once for each event on the date.

    • Past and future dates should be included to allow the model to learn from past events and apply to future dates.

    • Upon selecting the source, inputs will appear to map the Date and Event names fields.

    • An example source is shown below:

  • Source with manually mapped feature – This source can be used to add a single column that is mapped to a column in the Definition step source. This allows for the use of columns which do not have matching names in both sources.

    • Upon selecting the source, the following inputs will appear:

      • Date

      • Secondary Keys – Select any additional keys that should not be aggregated over. Common examples include the SKU or product category. Up to 5 keys may be selected.

        • After selecting keys, additional inputs will appear per key to map the keys to the matching columns from the definition step source.

        • Keys must be present in the definition step source, and should be unique for a given time period – fields such as channel and store should not be included here.

      • Feature – Select the feature column that should be added/updated.

      • Mapping to Definition Source – Select the matching column in the Definition step source (optional).

      • Feature aggregation method – Choose how the feature should be aggregated. The available options are:

        • Mode (= most frequent value)

        • Mean

        • Max

        • Min

      • Mode should be used if the feature contains categories, the others may be used for numerical features.

  • Source with multiple features This source is much like the Source with manually mapped feature, with the following differences:

    • Features – Any number of features may be included from the source.
      It is important that the names of any features intended to update the forecast must match those of the columns mapped in the Definition step source. There is one notable exception:

      • To include future prices for the forecast, include future dates and a column named price.

    • There is no input for Mapping to Definition Source feature.

Important note: The additional sources will not overwrite any of the data from the Definition step source. If there are historical dates in an additional source, any of selected features columns that match existing columns in the Definition step source will be ignored in the training step, and used only as future data for the forecast. A warning with details of the specific affected columns will be shown in the job details of the Model Training calculation in this case. If the intent is to provide also historical data, the feature column should not match any of the existing columns.

Model Training Step

The Continue button in the Additional Sources step will automatically run the calculation that starts the Model Training step. This calculation will gather the chosen fields from the Definition step source and process the data into a time series aggregated at the chosen level. It will then enrich the data with the following extra features:

  • Date related features to learn sales seasonality

  • Lag, difference, and rolling statistics features chosen in the Model Configuration tab of the Definition step

  • Product ages and recent sales activity features

If additional sources have been selected, they will be aggregated to the same level as the Definition step source and loaded into model tables. If they contain historical dates that match dates found in the Definition step source, they will be merged into the data used for model training.

The calculation will then split the data into a training set and test set according to the value chosen in the Model Configuration and use the training data to train a forecasting model, estimating its performance on the test set. The training results are displayed in the following three tabs:

Model Training Results Tab

This tab displays a number of charts that summarize the performance of the forecasting model:

  • The Feature Importances chart shows how strong the influence of each feature is on the model predictions. This may be used to assess the impact of including features in the additional categorical and numerical features inputs. Features with low importance can be removed to reduce future training time without significantly affecting model performance. Features with very low importances are not shown. If there are a large number of features in your model you may need to extend the height of this chart to view them clearly.

  • The Metrics table shows various statistics describing the performance of the model on both the training and test data. The available metrics are:

  • Note that when training a model using the log of the quantity field, the MAE, RMSE and Poisson metrics will reflect the errors in the predictions of the log quantity, and are therefore not directly comparable with results from a model that does not use the log quantity.

  • Scatter charts of the model predictions vs. the actual historical quantities for both the training data and the test data show how close the model’s predictions are to the known truth. The black dashed line represents the line of perfect predictions. A good model should show points being close to this line for both the training and test data.

Train and Test Forecasts Tab

This tab displays forecasts alongside historical quantity for the product selected on the left panel, as well as the total forecast for all products. The test set is shaded in green. For the single product forecasts, the historical price is also displayed.

Training Curves Tab

This tab displays diagnostic metrics of the model performance over the course of the training.

Elasticity Settings Tab

This tab defines the settings for the elasticity calculation in the Model Predictions step. The elasticity calculation may be optionally disabled to save on computation time. When Calculate elasticities is selected, the following options are available:

  • Fitting to get a quantity of 0 with a high price - This setting will replace parameter b of sigmoid curve with 0 (see formula in next step). This leads to quantity dropping to 0 for high price.

  • Adjust elasticity curve fit based on last known price prediction – This setting will force the calculated elasticity curve to go through the model prediction at the last known price. This may increase the reliability of elasticities for products/datasets with low price variation and reduce bias in outputs.

  • Fallback level For products with low transaction counts or low quality elasticity curves (due to low historical price variation for example) a fallback level may be set to provide a simple elasticity for these products based on the elasticities of other products at the defined fallback level. The available levels will be taken from the additional categorical features selected in the Definition step.

  • Minimum number of transactions per product – If a fallback level is set, products with fewer than this number of transactions will use the fallback elasticity. Note that this is separate from the minimum number of transactions defined on the Definition step, which defines the minimum number of transactions for a product to be included in the data scope.

  • Minimum elasticity curve R² score If a fallback level is set, products with R² scores below this value will use the fallback elasticity. The R²score used for this threshold is the average R² score for each product across all forecasted dates. As such, it is still possible to see R² scores under this threshold in the Elasticities table on the Model Predictions step for selected dates.

Model Predictions Step

If you are happy with the training results you can click Continue. This will begin the final calculation for the Model Predictions step. This calculation will train a final forecasting model on the full historical data and produce a recursive forecast (for the number of time steps selected in the definition step). Using the forecast predictions with varying prices it will then calculate elasticity curves for each product for each date of the forecast.

Once the elasticity curves are calculated, a sigmoidal curve is fit to the raw predictions from the machine learning model and an R² score for the quality of this fit to the model prediction is calculated. The formula for this sigmoidal curve is:

where x is the price, and x0, L, k, and b are the parameters of the curve.

Also calculated is a single-valued simple elasticity based on the tangent of the sigmoidal curve at the last known price with the following formula:

The median value of this simple elasticity at the fallback level is reported as the simple elasticity for the fallback.

The results are then displayed in the following two tabs:

Overview Tab

This tab displays overall results for all products in a number of charts and tables.

The sum of the individual product forecasts is shown as the Total product forecast, much like on the Train and Test Forecasts Tab of the Model Training step. The difference here is that the forecast is shown in the green shaded area.

Several histograms are displayed, showing the distribution of R² scores, simple elasticities and the k parameter of the sigmoid curve fit.

A table showing the elasticity data for each product, store, and date of the forecast is included. If the fallback level is set, a second table is displayed showing the simple elasticity for each value of the selected fallback level. Products identified as part of the fallback are removed from the elasticity data table.

If Calculate Elasticities is not selected, only the total forecast will be shown here.

Details Tab

This tab displays the predicted elasticity curves for the product and period start date chosen on the left. The chart shows the raw model predictions and a fitted s-curve, showing the R² score of the fit in the chart title. Also shown is the forecast for the selected product, with the selected date highlighted in yellow. The table shows the elasticity data for each product-date-store combination according to the calculated store fraction. This table may be empty if the product is part of the fallback products or has not sold in the chosen store fraction window.

If Calculate Elasticities is not selected, only the product forecast will be shown here.