Using Assortment Optimizer to Solve Association Problems

Rulex extracts and generates replacement rules from frequent itemsets via the Assortment Optimizer task. The task provides a list of replacement rules, which can be used to understand how to replace items with equivalent items to the best advantage. These rules, denoted as (A):B (i.e. item A replaced by item B), are qualified by different scores, according to available data, such as the cost of items.

A typical use case for this task could be when retailers need to reduce the inventory in specific categories of products, removing some products while minimizing loss of revenue. Rulex enables them to optimize assortment without losing customers, taking into account that clients may switch (together with all their purchases) to competitors if one of their favorite items is removed and it is not replaced by an equivalent product, thanks to replacement rules.

 
Prerequisites

Additional tabs

The following additional tabs are provided:

  • Documentation tab where you can document your task,

  • Parametric options tab where you can configure process variables instead of fixed values. Parametric equivalents are expressed in italics in this page. 

  • Replacement rules and Results tabs, where you can see the output of the task computation. See Results table below.


Procedure

  1. Drag and drop the Assortment Optimizer task onto the stage.

  2. Connect a task that contains the frequent itemsets from which you want to generate replacement rules, to the new task.

  3. Double click the Assortment Optimizer task. The left-hand pane displays a list of all the available attributes in the dataset, which can be ordered and searched as required.

  4. In the Options tab, configure the options as described in the table below.

  5. Save and compute the task.

Assortment Optimizer options

Name

Parametric options

Description

Maximum replaced item support #

popmaxrepsupth

The maximum number of occurrences in the dataset for items selected for replacement. If this value is set to 0, all items are considered as selected for replacement.

Minimum replacing item support #

popsupth

The maximum number of occurrences in the dataset for items selected to replace other items.

Category attribute

popcatname

Select the attribute which represents the category to which item belongs from the drop-down list. It is then possible to look for potential replacement items only within the same category as the item you are replacing. This improves accuracy, together with computational efficiency.

Item price attribute

poppricename

Select the attribute which represents the price of each item from the drop-down list. It specified, it is then possible to calculate the Minimum revenue replacement score.

Item cost attribute

popcostname

Select the attribute which represents the production cost of each item from the drop-down list. If specified, it is then possible to calculate the Minimum margin replacement score.

Items to replace


Drag and drop the attribute of the items you want to replace from the Available attributes list, specifying a filtering criterion. Rules to replace items satisfying this criterion are not discarded, regardless of the Maximum replaced item support # threshold.

Instead of manually dragging and dropping attributes, they can be defined via a filtered list.

Minimum alternativeness coefficient

popminalternativeness

The degree of alternativeness between the purchase of two items:

  • 1 (max) if they are never sold together

  • 0 (min) if if one item is always sold with the other one.

If a pair of items ensures the Minimum alternativeness coefficient, the corresponding replacement rule is discarded.

Minimum volume replacement score %

poprepcoeffth

The minimum percentage of orders in which a replaced item is expected to be replaceable by the replacing item. If this minimum threshold is not satisfied by a replacement rule, it is discarded.

Minimum revenue replacement score %

poprepcoeffthrev

The minimum percentage of revenue guaranteed by replaced item, which the replacing item is expected to obtain. If this minimum threshold is not satisfied by a replacement rule, it is discarded.

Minimum margin replacement score %

poprepcoeffthmargin

The minimum percentage of gain guaranteed by the replaced item, which the replacing item is are expected to obtain. If this minimum threshold is not overcome by a replacement rule, it is discarded.

Results

The results of the task are displayed in two separate tabs:

  • The Replacement rules tab displays the generated item sets, where: 

    • Replacement rule ID: the sequential ID number for replacement rules.

    • Replaced item ID: identifier of items selected to be replaced.

    • Replaced item support #: the number of occurrences in the dataset for items selected to be replaced.

    • Replaced item loneliness: percentage of transactions constituted only by the replaced item, with respect to all the transactions involving it.

    • Replacing item ID: identifiers of replacing items.

    • Replacing item support #: number of occurrences in the dataset for replacing items.

    • Alternativeness coefficient: alternativeness between the purchase of the replaced and the replacing items.

    • Volume replacement score %: percentage of orders in which the replaced item is expected to be replaceable by replacing item

    • Exclusive volume replacement score %: percentage of orders in which the replaced item is expected to be replaceable only by replacing item, among all considered items.

    • Replaced item revenue pulling factor: ratio between revenues guaranteed by orders involving the replaced items and revenues guaranteed by the replaced items themselves.

    • Replacing item revenue pulling factor: ratio between revenues guaranteed by orders involving the replacing items and revenues guaranteed by the replacing items themselves.

    • Actual total revenue related to replaced item: whole revenue guaranteed by orders involving the replaced items.

    • Revenue replacement score %: percentage of revenue guaranteed by the replaced item, which the replacing item is expected to obtain.

    • Exclusive revenue replacement score %: percentage of revenue guaranteed by the replaced item, which only the replacing item is expected to obtain, among all the considered items.

    • Actual total margin related to replaced item: whole margin guaranteed by orders involving the replaced items.

    • Margin replacement score %: percentage of revenue guaranteed by replaced item, which the replacing item is expected to obtain

    • Exclusive Margin replacement score %: percentage of revenue guaranteed by replaced item, which only the replacing item is expected to obtains, among all the considered items.

  • The Results tab displays details on the execution of the analysis, where:

    • Task Identifier: ID code for the task, internally used by the Rulex engine.

    • Task Name: simply the name of the task.

    • Elapsed time (sec): the time required for latest computation (in seconds).

    • Number of generated replacement rules: the number of replacement rules generated by the task.

Example

In the example process, replacement rules are extracted from imported data sets, one containing order transaction data (hba_test), and the second containing prices and production costs (hba_test_prices_cost).

Scenario data can be found in the Datasets folder in your Rulex installation.

The following steps were performed:

  1. First we import the hba-test dataset. Each row of the dataset represents a transaction, composed by Order ID and a variable number of Item IDs.

  2. The attribute data type is changed to nominal in a Data Manager task

  3. The hba_test dataset is restructured in the Reshape To Long task.

  4. Then we import the hba-test-prices-costs dataset. This dataset gathers information about the price and the production cost of each item. 

  5. The data type of the Item_ID attribute is changed to nominal in a Data Manager task

  6. The two datasets are merged in a Join task.

  7. Frequent sequences are extracted with the Frequent Itemsets Mining task.

  8. Replacement rules are generated from the frequent itemsets with the Assortment Optimizer.

Procedure

Screenshot

First we import the hba-test dataset with an Import from Text File task.

Then add a Data Manager task, select all the attributes in the Attributes list (using the SHIFT button), right-click and select Type > Nominal.



Add a Reshape to Long task to the process to restructure the data so that the information concerning a purchase of N items is distributed over N rows, each one including a couple Order ID/Item ID.

To do this drag and drop all the Item_ID xx attributes onto the Attributes to be transformed in long format edit box, then save and compute the task.

We then import the hba-test-prices-costs dataset with an Import from Text File task, and add another Data Manager to set the Item_ID attribute to Nominal

The data type of the price and cost attributes must remain continuous.

We then add a Join task to the process to merge this new dataset with the hba-test dataset, and configure it as follows:

  • select the Order_ID attribute in the ReshapeToLong task output

  • select all the attributes in the hba-test-prices-costs dataset

  • match the Wide_1 attribute from the ReshapeToLong task output with the Item_ID column in the hba-test-prices-costs dataset.

We then add a Frequent Itemsets Mining task, and configure it as follows:

  • set the Order_Id as Order key attribute

  • set Item_ID as the Item child attribute

  • set Maximum itemset cardinality to 3

  • select the auto (specify #) checkbox

  • set # Items to consider to 50.

The identified frequent itemsets are displayed in the corresponding tab.


We now add an Assortment Optimizer task, and select the Price attribute as the Item price attribute and the Cost attribute as the Item cost attribute.

The generated replacement rules are displayed in the corresponding tab.