IDEAS home Printed from https://ideas.repec.org/p/ecl/stabus/4106.html
   My bibliography  Save this paper

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

Author

Listed:
  • Du, Tianyu

    (Stanford U)

  • Kanodia, Ayush

    (Stanford U)

  • Athey, Susan

    (Stanford U)

Abstract

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

Suggested Citation

  • Du, Tianyu & Kanodia, Ayush & Athey, Susan, 2023. "Torch-Choice: A PyTorch Package for Large-Scale Choice Modelling with Python," Research Papers 4106, Stanford University, Graduate School of Business.
  • Handle: RePEc:ecl:stabus:4106
    as

    Download full text from publisher

    File URL: https://arxiv.org/abs/2304.01906
    Download Restriction: no
    ---><---

    Other versions of this item:

    References listed on IDEAS

    as
    1. 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.
    2. Train,Kenneth E., 2009. "Discrete Choice Methods with Simulation," Cambridge Books, Cambridge University Press, number 9780521766555.
    3. 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.
    4. 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.
    5. 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.
    6. Berry, Steven & Levinsohn, James & Pakes, Ariel, 1995. "Automobile Prices in Market Equilibrium," Econometrica, Econometric Society, vol. 63(4), pages 841-890, July.
    7. 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.
    8. 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.
    9. 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.
    10. 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.
    11. 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.
    12. 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.
    13. McFadden, Daniel, 1974. "The measurement of urban travel demand," Journal of Public Economics, Elsevier, vol. 3(4), pages 303-328, November.
    Full references (including those not matched with items on IDEAS)

    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:ecl:stabus:4106. 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: the person in charge (email available below). General contact details of provider: https://edirc.repec.org/data/gsstaus.html .

    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.