Choice-Learn: Large-scale choice modeling for operational contexts through the lens of machine learning
- Authors
- Vincent Auriau
- Ali Aouad
- Antoine Désir
- Emmanuel Malherbe
- Affiliations
- Artefact Research Center
- MICS, CentraleSupélec, Université Paris-Saclay
- London Business School
- INSEAD
- Accepted at
- Journal of Open Source Software 2024
- Date
Cite this paper
@article{auriau2024choicelearn,
title = {Choice-Learn: Large-scale choice modeling for operational contexts through the lens of machine learning},
author = {Vincent Auriau and Ali Aouad and Antoine Désir and Emmanuel Malherbe},
journal = {Journal of Open Source Software},
year = {2024},
doi = {10.21105/joss.06899},
url = {https://doi.org/10.21105/joss.06899}
}Copied
Introduction
Discrete choice models aim at predicting choice decisions made by individuals from a menu of alternatives, called an assortment[cite: 1]. Well-known use cases include predicting a commuter's choice of transportation mode or a customer's purchases[cite: 1]. Choice models are able to handle assortment variations, when some alternatives become unavailable or when their features change in different contexts[cite: 1]. This adaptability to different scenarios allows these models to be used as inputs for optimization problems, including assortment planning or pricing[cite: 1].
Choice-Learn provides a modular suite of choice modeling tools for practitioners and academic researchers to process choice data, and then formulate, estimate and operationalize choice models[cite: 1]. The library is structured into two levels of usage, as illustrated in Figure 1[cite: 1]. The higherlevel is designed for fast and easy implementation and the lower-level enables more advanced parameterizations[cite: 1]. This structure, inspired by Keras' different endpoints [7], enables a user-friendly interface[cite: 1]. Choice-Learn is designed with the following objectives[cite: 1]:
Streamlined: The processing of datasets and the estimation of standard choice models are facilitated by a simple code signature that are consistent with mainstream machine learning packages such as scikit-learn [16][cite: 1].
Scalable: Optimized processes are implemented for data storage and models estimation, allowing the use of large datasets and models with a large number of parameters[cite: 1].
Flexible: The codebase can be customized to fit different use cases[cite: 1].
Models Library: The same package provides implementations of both standard choice models and machine learning-based methods, including neural networks[cite: 1].
Downstream operations: Post-processing tools that leverage choice models for assortment planning and pricing are integrated into the library[cite: 1].
The main contributions are summarized in Tables 1 and 2.
Statement of need
Data and model scalability
Choice-Learn's data management relies on NumPy [11] with the objective of limiting the memory footprint[cite: 1]. It minimizes the repetition of items or customers features and defers the jointure of the full data structure until processing batches of data[cite: 1]. The package introduces the FeaturesStorage object, illustrated in Figure 2, that allows feature values to be referenced only by their ID[cite: 1]. These values are substituted to the ID placeholder on the fly in the batching process[cite: 1]. For instance, supermarkets features such as surface or position are often stationary[cite: 1]. Thus, they can be stored in an auxiliary data structure and in the main dataset, the store where the choice is recorded is only referenced with its ID[cite: 1].
The package stands on Tensorflow [1] for model estimation, offering the possibility to use fast quasi-Newton optimization algorithm such as L-BFGS [15] as well as various gradient-descent optimizers [20, 12] specialized in handling batches of data[cite: 1]. GPU usage is also possible, which can prove to be time-saving[cite: 1]. Finally, the TensorFlow backbone ensures an efficient usage in a production environment, for instance within an assortment recommendation software, through deployment and serving tools, such as TFLite and TFServing[cite: 1].
Flexible usage: From linear utility to customized specification
Choice models following the Random Utility Maximization principle [13] define the utility of an alternative as the sum of a deterministic part and a random error [cite: 1]. If the terms are assumed to be independent and Gumbel-distributed, the probability to choose alternative can be written as the softmax normalization over the available alternatives [cite: 1]:
The choice-modeler’s job is to formulate an adequate utility function depending on the context[cite: 1]. In Choice-Learn, the user can parametrize predefined models or freely specify a custom utility function[cite: 1]. To declare a custom model, one needs to inherit the ChoiceModel class and overwrite the compute_batch_utility method as shown in the documentation[cite: 1].
Library of traditional random utility models and machine learning-based models
Traditional parametric choice models, including the Conditional Logit [21], often specify the utility function in a linear form[cite: 1]. This provides interpretable coefficients but limits the predictive power of the model[cite: 1]. Recent works propose the estimation of more complex models, with neural networks approaches [10, 2] and tree-based models [18, 3][cite: 1]. While existing choice libraries [5, 6, 8] are often not designed to integrate such machine learning-based approaches, Choice-Learn proposes a collection including both types of models[cite: 1].
Batch of data
Downstream operations: Assortment and pricing optimization
Choice-Learn offers additional tools for downstream operations, that are not usually integrated in choice modeling libraries[cite: 1]. In particular, assortment optimization is a common use case that leverages a choice model to determine the optimal subset of alternatives to offer customers maximizing a certain objective, such as the expected revenue, conversion rate, or social welfare[cite: 1]. This framework captures a variety of applications such as assortment planning, display location optimization, and pricing[cite: 1]. We provide implementations based on the mixed-integer programming formulation described in [14], with the option to choose the solver between Gurobi [9] and OR-Tools [17][cite: 1].


Memory usage: a case study
We provide in Figure 3 (a) numerical examples of memory usage to showcase the efficiency of the FeaturesStorage[cite: 1]. We consider a feature repeated in a dataset, such as a one-hot encoding for locations, represented by a matrix of shape (#locations, #locations) where each row refers to one location[cite: 1].
We compare four data handling methods on the Expedia dataset [4]: pandas.DataFrames [19] in long and wide format, both used in choice modeling packages, Torch-Choice and Choice-Learn[cite: 1]. Figure 3 (b) shows the results for various sample sizes[cite: 1].
Finally, in Figure 3 (c) and (d), we observe memory usage gains on a proprietary dataset in for different number of stores brick-and-mortar retailing consisting of the aggregation of more than 4 billion purchases in Konzum supermarkets in Croatia[cite: 1]. Focusing on the coffee subcategory, the dataset specifies, for each purchase, which products were available, their prices, as well as a one-hot representation of the supermarket[cite: 1].

Next step
A problem worth researching?
Tell us what you are trying to solve, and we will put you in touch with the people who work on it.