English

Torch-Choice: A PyTorch Package for Large-Scale Choice Modeling with Python

Machine Learning 2025-06-05 v4 Mathematical Software Econometrics

Abstract

The torch-choice\texttt{torch-choice} is an open-source library for flexible, fast choice modeling with Python and PyTorch. torch-choice\texttt{torch-choice} provides a ChoiceDataset\texttt{ChoiceDataset} data structure to manage databases flexibly and memory-efficiently. The paper demonstrates constructing a ChoiceDataset\texttt{ChoiceDataset} from databases of various formats and functionalities of ChoiceDataset\texttt{ChoiceDataset}. The package implements two widely used models, namely the multinomial logit and nested logit models, and supports regularization during model estimation. The package incorporates the option to take advantage of GPUs for estimation, allowing it to scale to massive datasets while being computationally efficient. Models can be initialized using either R-style formula strings or Python dictionaries. We conclude with a comparison of the computational efficiencies of torch-choice\texttt{torch-choice} and mlogit\texttt{mlogit} in R as (1) the number of observations increases, (2) the number of covariates increases, and (3) the expansion of item sets. Finally, we demonstrate the scalability of torch-choice\texttt{torch-choice} on large-scale datasets.

Keywords

Cite

@article{arxiv.2304.01906,
  title  = {Torch-Choice: A PyTorch Package for Large-Scale Choice Modeling with Python},
  author = {Tianyu Du and Ayush Kanodia and Susan Athey},
  journal= {arXiv preprint arXiv:2304.01906},
  year   = {2025}
}
R2 v1 2026-06-28T09:49:15.595Z