Technical User Reference (Optimization - Product Recommendation)

This section details the Model Class and logics that the Product Recommendation Accelerator deploys. For each step, its aim, its outputs, and the main reasons to modify the logics are explained.

In this section:

 

Product Recommendation 2 Model Class

The ProductRecommendation V2 (PR2) ModelClass organizes a list of logics to create the model architecture. It is a JSON file that refers to some logics and it is transformed into an optimized UI in the Pricefx platform. It is organized in 3 steps:

  1. Definition – Maps the transaction source.

  2. Configuration – Allows selection of different types of recommendations and their configuration.

  3. Product Recommendations – Provides summary of calculated recommendations, and enables their exploration and manual adding of recommendations.

See Model Classes for more information.

Recommendation Types

There are seven recommendation types in PR2: Frequently Purchased, Others buy, Bought together, Similar products, Similar from another brand, Up-sell, and Down-sell. For details on each type, see Overview (Optimization - Product Recommendation).

We can group these recommendations in two ways:

  1. Who are they producing recommendations for:

    1. Recommendations for product (Product to product) – Bought together, Similar products, Similar from another brand, Up-sell, Down-sell

    2. Recommendations for customer (Customer to product) – Frequently Purchased

    3. Recommendations for segment (Segment to product) – Others buy

  2. What information are they based on:

    1. Transaction based – Frequently Purchased, Others buy, Bought together

      1. Customer based (Frequently Purchased and Others buy need additional information about customer)

    2. Similarity based – Similar products, Similar from another brand, Up-sell, Down-sell

These groups are mentioned for two reasons. First, after calculation of each individual category, Product to product recommendations are aggregated into a single table, and shown together in a graph and table on the Review Recommendations tab. Second, what information are they based on is important for their configuration, and how they are grouped together there.

Optionality of Recommendation Types

In contrast with ProductRecommendation V1, every recommendation type is now optional, and can be either turned on or off, while the rest of model works normally.

Each calculation logic contains an element called EnabledCheck, this element cancels the calculation if the related recommendation is disabled. The element EnabledCheck is present in every calculation with the exception of DataPrep and PostProcessing, as those are not based around a single recommendation category. The following reference is written as if all categories are enabled, not discussing in each step what happens if they are not.

Disabled Recommendations

If some recommendation type is disabled, then:

  • If part of DataPrep depends on it, this part is skipped, i.e. there is no CustomerIds table if customer based recommendations are disabled, and no SegmentMapTable if Others buy is disabled.

  • Its calculation is skipped.

  • In PostProcessing if all product to product types are disabled, the AggregatedRecQuery element is skipped, otherwise the disabled category is not included in aggregation. The RecTypeSharedProductsCount table is created with all categories, even if they are disabled.

  • In the Summary tab the disabled type is not present in the portlet and graph.

  • Review Recommendations tab – If the customer based types are disabled, there is no input for customers. Disabled category is not present in the graph and among portlets. If some of product to product types are disabled, and some enabled, we still have product to product recommendations in the graph and in the portlet, as they are sourced from ProductAggregatedTable, which is missing only if all product to product recommendations are disabled.

  • Add Manual Recommendations tab – If the recommendation type is disabled, we are not able to add any valid manual recommendations for this type.

  • In Evaluation – If the name of a disabled category is passed as categoryName, an alert is created and null returned by the element ProductRecommendation. In AggregatedRecommendation (categoryName = 'aggregated'), the disabled type is not added to aggregation, even if it is explicitly mentioned among includedRecommendations.

Library

The logic is PR2_Lib.

 

PR2_Lib contains the following elements:

CustSegPyUtils – Script and values needed to generate customer segments using scikit-learn clustering.

DefinitionUtils – Contains functions allowing access to user defined values from steps Definition and Configuration.

QueryFormattingUtils – Tools for formatting numeric fields in SQL query.

LabelUtils – Contains text that is shown in the UI.

ManualRecommendationUtils – Tools used to read user defined manual recommendations.

ParameterUtils – Names of parameters used for naming of inputs and everywhere in the code.

SimilarityUtils – Names and tools associated with Product Similarity Model Class.

TableCreateUtils – Tools used to create tables used by model.

TableUtils – Names of tables and table fields used by model.

ValueUtils – Values used as defaults for inputs.

MixpanelUtils – Tools for tracking of model usage inside Mixpanel.

Change text visible to users in LabelUtils or in case of table / table fields names in TableUtils.

Change default values for inputs in ValueUtils. If the name of Product Similarity ModelClass or its relevant table or table field was modified, change SimilarityUtils accordingly.

Definition Step

This step allows selection of transaction source, and mapping of its fields.

The logics are PR2_Def_Eval_Scope and PR2_Def_Eval_Scope_Configurator.

These logics provide the user input to define a transaction source, filter it and map it. The main logic calls the configurator and the code for the dashboard portlets.

A dashboard shows the transactions in the scope and the filtered-out transactions. It is an evaluation logic, so nothing is written in the model, but the user inputs defining the data mapping are available in the next steps.

Add additional mappings.

Configuration Step

This step allows selection of different types of recommendations and their configuration.

The logic is PR2_Conf_Eval_Configuration_Configurator.

Product Recommendations Step

In this step, first all recommendations are calculated based on the previous user inputs. Then, three tabs are present, allowing users to explore results of those calculations and add manual recommendations. The Summary tab provides a summary for each recommendation type. The Review Recommendations tab allows users to observe recommendations for selected Products and Customers. In the Add Manual Recommendations tab additional recommendations can be manually added.

Calculation: DataPrep

The logic is PR2_Rec_Calc_DataPrep.

Calculation: LoadSimilarityMetaTable

Combines product information from the transaction source with similarity information from the Product Similarity model, creating a source table for all similarity based recommendations.

The logic is PR2_Rec_Calc_CreateSimProdSourceTable.

Calculation: LoadSimilarRecommendations

The logic is PR2_Rec_Calc_CreateSimilarRecommendations.

Calculation: LoadUpSellRecommendations

The logic is PR2_Rec_Calc_CreateUpSellRecommendations.

Calculation: LoadDownSellRecommendations

The logic is PR2_Rec_Calc_CreateDownSellRecommendations.

Calculation: LoadBrandRecommendations

The logic is PR2_Rec_Calc_CreateBrandRecommendations.

Calculation: LoadProductRecommendations

The logic is PR2_Rec_Calc_CreateProductRecommendations.

Calculation: LoadCustomerRecommendations

The logic is PR2_Rec_Calc_CreateCustomerRecommendations.

Calculation: LoadSegmentRecommendations

The logic is PR2_Rec_Calc_CreateSegmentRecommendations.

Calculation: PostProcessing

The logic is PR2_Rec_Calc_PostProc.

Summary Tab

The logic is PR2_Rec_Eval_Summary.

Review Recommendations Tab

The logics are PR2_Rec_Eval_Review_Configurator and PR2_Rec_Eval_Review.

Add Manual Recommendations Tab

The logic is PR2_Rec_Eval_Manual_Configurator.

Evaluation

The model has a single evaluation ProductRecommendation_Eval.

The logic is PR2_ModelEval_ProductRecommendation.