IDEAS home Printed from https://ideas.repec.org/p/arx/papers/2304.01906.html
   My bibliography  Save this paper

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

Author

Listed:
  • Tianyu Du
  • Ayush Kanodia
  • Susan Athey

Abstract

The $\texttt{torch-choice}$ is an open-source library for flexible, fast choice modeling with Python and PyTorch. $\texttt{torch-choice}$ provides a $\texttt{ChoiceDataset}$ data structure to manage databases flexibly and memory-efficiently. The paper demonstrates constructing a $\texttt{ChoiceDataset}$ from databases of various formats and functionalities of $\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 $\texttt{torch-choice}$ and $\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 $\texttt{torch-choice}$ on large-scale datasets.

Suggested Citation

  • Tianyu Du & Ayush Kanodia & Susan Athey, 2023. "Torch-Choice: A PyTorch Package for Large-Scale Choice Modelling with Python," Papers 2304.01906, arXiv.org, revised Jul 2023.
  • Handle: RePEc:arx:papers:2304.01906
    as

    Download full text from publisher

    File URL: http://arxiv.org/pdf/2304.01906
    File Function: Latest version
    Download Restriction: no
    ---><---

    Other versions of this item:

    References listed on IDEAS

    as
    1. Robert Donnelly & Francisco J.R. Ruiz & David Blei & Susan Athey, 2021. "Counterfactual inference for consumer choice across many product categories," Quantitative Marketing and Economics (QME), Springer, vol. 19(3), pages 369-407, December.
    2. Train,Kenneth E., 2009. "Discrete Choice Methods with Simulation," Cambridge Books, Cambridge University Press, number 9780521766555, September.
    3. Steven Berry & James Levinsohn & Ariel Pakes, 2004. "Differentiated Products Demand Systems from a Combination of Micro and Macro Data: The New Car Market," Journal of Political Economy, University of Chicago Press, vol. 112(1), pages 68-105, February.
    4. Bonoma, Thomas V & Johnston, Wesley J, 1979. "Decision Making under Uncertainty: A Direct Measurement Approach," Journal of Consumer Research, Journal of Consumer Research Inc., vol. 6(2), pages 177-191, Se.
    5. Tom Kornstad & Thor Thoresen, 2007. "A discrete choice model for labor supply and childcare," Journal of Population Economics, Springer;European Society for Population Economics, vol. 20(4), pages 781-803, October.
    6. Arthur van Soest, 1995. "Structural Models of Family Labor Supply: A Discrete Choice Approach," Journal of Human Resources, University of Wisconsin Press, vol. 30(1), pages 63-88.
    7. Christopher Conlon & Jeff Gortmaker, 2023. "Incorporating Micro Data into Differentiated Products Demand Estimation with PyBLP," NBER Working Papers 31605, National Bureau of Economic Research, Inc.
    8. Robert Donnelly & Francisco J. R. Ruiz & David Blei & Susan Athey, 2021. "Correction to: Counterfactual inference for consumer choice across many product categories," Quantitative Marketing and Economics (QME), Springer, vol. 19(3), pages 409-409, December.
    9. McFadden, Daniel, 1974. "The measurement of urban travel demand," Journal of Public Economics, Elsevier, vol. 3(4), pages 303-328, November.
    10. Bhat, Chandra R., 1995. "A heteroscedastic extreme value model of intercity travel mode choice," Transportation Research Part B: Methodological, Elsevier, vol. 29(6), pages 471-483, December.
    11. Chintagunta, Pradeep & Kyriazidou, Ekaterini & Perktold, Josef, 2001. "Panel data analysis of household brand choices," Journal of Econometrics, Elsevier, vol. 103(1-2), pages 111-153, July.
    12. Berry, Steven & Levinsohn, James & Pakes, Ariel, 1995. "Automobile Prices in Market Equilibrium," Econometrica, Econometric Society, vol. 63(4), pages 841-890, July.
    13. Susan Athey & David Blei & Robert Donnelly & Francisco Ruiz & Tobias Schmidt, 2018. "Estimating Heterogeneous Consumer Preferences for Restaurants and Travel Time Using Mobile Location Data," AEA Papers and Proceedings, American Economic Association, vol. 108, pages 64-67, May.
    Full references (including those not matched with items on IDEAS)

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Guhl, Daniel, 2024. "Tracking time-varying brand equity using household panel data," Journal of Business Research, Elsevier, vol. 182(C).

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Rolf Aaberge & Ugo Colombino, 2014. "Labour Supply Models," Contributions to Economic Analysis, in: Handbook of Microsimulation Modelling, volume 127, pages 167-221, Emerald Group Publishing Limited.
    2. Robert Donnelly & Francisco J.R. Ruiz & David Blei & Susan Athey, 2021. "Counterfactual inference for consumer choice across many product categories," Quantitative Marketing and Economics (QME), Springer, vol. 19(3), pages 369-407, December.
    3. Rolf Aaberge & Ugo Colombino, 2018. "Structural Labour Supply Models and Microsimulation," International Journal of Microsimulation, International Microsimulation Association, vol. 11(1), pages 162-197.
    4. Griffith, Rachel & O'Connell, Martin & Miller, Helen, 2011. "Corporate taxes and the location of intellectual property," CEPR Discussion Papers 8424, C.E.P.R. Discussion Papers.
    5. Pathak, Parag A. & Shi, Peng, 2021. "How well do structural demand models work? Counterfactual predictions in school choice," Journal of Econometrics, Elsevier, vol. 222(1), pages 161-195.
    6. Pereira, Pedro & Ribeiro, Tiago, 2011. "The impact on broadband access to the Internet of the dual ownership of telephone and cable networks," International Journal of Industrial Organization, Elsevier, vol. 29(2), pages 283-293, March.
    7. John K. Dagsvik & Zhiyang Jia, 2016. "Labor Supply as a Choice Among Latent Jobs: Unobserved Heterogeneity and Identification," Journal of Applied Econometrics, John Wiley & Sons, Ltd., vol. 31(3), pages 487-506, April.
    8. Pierre Dubois & Rachel Griffith & Martin O'Connell, 2020. "How Well Targeted Are Soda Taxes?," American Economic Review, American Economic Association, vol. 110(11), pages 3661-3704, November.
    9. Nicholas Economides & Katja Seim & V. Brian Viard, 2008. "Quantifying the benefits of entry into local phone service," RAND Journal of Economics, RAND Corporation, vol. 39(3), pages 699-730, September.
    10. Bernard Fortin & Nicolas Jacquemet & Bruce Shearer, 2008. "Policy Analysis in Health-Services Market: Accounting for Quality and Quantity," Annals of Economics and Statistics, GENES, issue 91-92, pages 293-319.
    11. Rachel Griffith & Lars Nesheim & Martin O'Connell, 2018. "Income effects and the welfare consequences of tax in differentiated product oligopoly," Quantitative Economics, Econometric Society, vol. 9(1), pages 305-341, March.
    12. Jan De Loecker & Paul T. Scott, 2016. "Estimating market power Evidence from the US Brewing Industry," NBER Working Papers 22957, National Bureau of Economic Research, Inc.
    13. Takahiko Kiso, 2019. "Evaluating New Policy Instruments of the Corporate Average Fuel Economy Standards: Footprint, Credit Transferring, and Credit Trading," Environmental & Resource Economics, Springer;European Association of Environmental and Resource Economists, vol. 72(2), pages 445-476, February.
    14. Susan Athey & Guido W. Imbens, 2007. "Discrete Choice Models With Multiple Unobserved Choice Characteristics," International Economic Review, Department of Economics, University of Pennsylvania and Osaka University Institute of Social and Economic Research Association, vol. 48(4), pages 1159-1192, November.
    15. John K. Dagsvik & Zhiyang Jia, 2014. "Labor supply as a discrete choice among latent jobs: Unobserved heterogeneity and identification," Discussion Papers 786, Statistics Norway, Research Department.
    16. Nicholas-James Clavet & Luca Tiberti & Marko Vladisavljevic & Jelena Zarkovic Rakic & Aleksandra Anic & Gorana Krstic & Sasa Randelovic, 2017. "Reduction of child poverty in Serbia: Improved cash-transfers or higher work incentives for parents?," Working Papers PMMA 2017-04, PEP-PMMA.
    17. Patrick Bigler & Doina Maria Radulescu, 2022. "Environmental, Redistributive and Revenue Effects of Policies Promoting Fuel Efficient and Electric Vehicles," CESifo Working Paper Series 9645, CESifo.
    18. Martin, Elliott William, 2009. "New Vehicle Choice, Fuel Economy and Vehicle Incentives: An Analysis of Hybrid Tax Credits and the Gasoline Tax," University of California Transportation Center, Working Papers qt5gd206wv, University of California Transportation Center.
    19. Krueger, Rico & Bierlaire, Michel & Daziano, Ricardo A. & Rashidi, Taha H. & Bansal, Prateek, 2021. "Evaluating the predictive abilities of mixed logit models with unobserved inter- and intra-individual heterogeneity," Journal of choice modelling, Elsevier, vol. 41(C).
    20. Martin, Elliot William, 2009. "New Vehicle Choices, Fuel Economy and Vehicle Incentives: An Analysis of Hybrid Tax Credits and Gasoline Tax," University of California Transportation Center, Working Papers qt6sz198c2, University of California Transportation Center.

    More about this item

    NEP fields

    This paper has been announced in the following NEP Reports:

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:arx:papers:2304.01906. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: arXiv administrators (email available below). General contact details of provider: http://arxiv.org/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.