Hamsa Bastani

Hamsa Bastani
  • Assistant Professor of Operations, Information and Decisions

Contact Information

  • office Address:

    3730 Walnut Street
    557 Jon M. Huntsman Hall
    Philadelphia, PA 19104

Research Interests: machine learning algorithms & applications to healthcare, revenue management, social good

Links: Personal Website, CV


Hamsa Bastani is an assistant professor in Operations Information and Decisions at the Wharton School, University of Pennsylvania. Her research focuses on developing novel machine learning algorithms for data-driven decision-making, with applications to healthcare operations, pricing, recommendation systems, and social good. Her work has been recognized by the George Nicholson, MSOM, Service Science, and Health Applications Society best student paper awards, the Pierskalla best paper award in healthcare operations, and the early-career People’s Choice award in sustainable operations. She previously completed her PhD at Stanford University, and was a Herman Goldstine postdoctoral fellow at IBM Research.

Continue Reading


  • Pia Ramchandani, Hamsa Bastani, Emily Wyatt (Under Review), Unmasking Human Trafficking Risk in Commercial Sex Supply Chains with Machine Learning.

    Abstract: The covert nature of sex trafficking provides a significant barrier to generating large-scale, data-driven insights to inform law enforcement, policy and social work. We leverage massive deep web data (collected globally from leading commercial sex websites) in tandem with a novel machine learning framework to unmask suspicious recruitment-to-sales pathways, thereby providing the first global network view of trafficking risk in commercial sex supply chains. This allows us to infer likely recruitment-to-sales trafficking routes of criminal entities, deceptive approaches used to recruit victims, and regional variations in recruitment vs. sales pressure. These insights can help law enforcement agencies along trafficking routes better coordinate efforts, as well as target local counter-trafficking policies and interventions towards exploitative behavior frequently exhibited in that region.

  • Wanqiao Xu, Kan Xu, Hamsa Bastani, Osbert Bastani (Under Review), Mind the Gap: Safely Bridging Offline and Online Reinforcement Learning.

    Abstract: A key challenge to deploying reinforcement learning in practice is exploring safely. We propose a natural safety property—uniformly outperforming a conservative policy (adaptively estimated from all data observed thus far), up to a per-episode exploration budget. This property formalizes the idea that we should spread out exploration to avoid taking actions significantly worse than the ones that are currently known to be good. We then design an algorithm that uses a UCB reinforcement learning policy for exploration, but overrides it as needed to ensure safety with high probability. To ensure exploration across the entire state space, it adaptively determines when to explore (at different points of time across different episodes) in a way that allows “stitching” sub-episodes together to obtain a meta-episode that is equivalent to using UCB for the entire episode. Then, we establish reasonable assumptions about the underlying MDP under which our algorithm is guaranteed to achieve sublinear regret while ensuring safety; under these assumptions, the cost of imposing safety is only a constant factor.

  • Kan Xu, Hamsa Bastani, Osbert Bastani (Under Review), Robust Generalization of Quadratic Neural Networks via Function Identification.

    Abstract: A key challenge facing deep learning is that neural networks are often not robust to shifts in the underlying data distribution. We study this problem from the perspective of the statistical concept of parameter identification. Generalization bounds from learning theory often assume that the test distribution is close to the training distribution. In contrast, if we can identify the “true” parameters, then the model generalizes to arbitrary distribution shifts. However, neural networks are typically overparameterized, making parameter identification impossible. We show that for quadratic neural networks, we can identify the function represented by the model even though we cannot identify its parameters. Thus, we can obtain robust generalization bounds even in the overparameterized setting. We leverage this result to obtain new bounds for contextual bandits and transfer learning with quadratic neural networks. Overall, our results suggest that we can improve robustness of neural networks by designing models that can represent the true data generating process. In practice, the true data generating process is often very complex; thus, we study how our framework might connect to neural module networks, which are designed to break down complex tasks into compositions of simpler ones. We prove robust generalization bounds when individual neural modules are identifiable.

  • Hamsa Bastani, Kimon Drakopoulos, Vishal Gupta, Jon Vlachogiannis, Christos Hadjicristodoulou, Pagona Lagiou, Gkikas Magiorkinis, Dimitrios Paraskevis, Sotirios Tsiodras (Draft), Deploying an Artificial Intelligence System for COVID-19 Testing at the Greek Border.

    Abstract: On July 1st, 2020, members of the European Union gradually lifted earlier COVID-19 restrictions on non-essential travel. In response, we designed and deployed “EVA” – a novel, self-learning artificial intelligence system – across all Greek borders to identify asymptomatic travelers infected with SARS-CoV-2 based on demographic characteristics and results from previously tested travelers. EVA allocates Greece’s limited testing resources to (i) limit the importation of new cases and (ii) provide real-time estimates of COVID-19 prevalence to inform border policies. Counterfactual analysis shows that our system identified on average 1.85x as many asymptomatic, infected travelers as random surveillance testing, and up to 2-4x as many during peak travel. Moreover, for most countries, EVA identified atypically high prevalence 9-days earlier than machine learning systems based on publicly reported data. By adaptively adjusting border policies 9-days earlier, EVA prevented additional infected travelers from arriving. Finally, using EVA’s unique cross-country, large-scale dataset on prevalence in asymptomatic populations, we show that commonly used public data on cases/deaths/testing have limited predictive value for the prevalence among asymptomatic travelers, and furthermore exhibit strong country-specific idiosyncrasies. As herd immunity is still likely more than a year away [1], and travel protocols for the summer of 2021 are still being discussed, our insights raise serious concerns about internationally proposed border control policies [2] that are both country-agnostic and solely based on public data. Instead, our work paves the way for leveraging AI and real-time data for public health goals, such as border control during a pandemic. * HB, KD and VG contributed equally to this work.

  • Kan Xu, Xuanyi Zhao, Hamsa Bastani, Osbert Bastani (Draft), Group-Sparse Matrix Factorization for Transfer Learning of Word Embeddings.

    Abstract: Sparse regression has recently been applied to enable transfer learning from very limited data. We study an extension of this approach to unsupervised learning—in particular, learning word embeddings from unstructured text corpora using low-rank matrix factorization. Intuitively, when transferring word embeddings to a new domain, we expect that the embeddings change for only a small number of words—e.g., the ones with novel meanings in that domain. We propose a novel group-sparse penalty that exploits this sparsity to perform transfer learning when there is very little text data available in the target domain—e.g., a single article of text. We prove generalization bounds for our algorithm. Furthermore, we empirically evaluate its effectiveness, both in terms of prediction accuracy in downstream tasks as well as the interpretability of the results.

  • Hamsa Bastani, Osbert Bastani, Wichinpong Sinchaisri (Draft), Learning Best Practices: Can Machine Learning Improve Human Decision-Making?.

    Abstract: Workers spend a significant amount of time learning how to make good decisions. The learning process is challenging because outcomes are often long-term and relate to the original decision in complex ways, making it hard to evaluate the efficacy of a given decision. The goal of our paper is to study whether machine learning can be used to infer tips that can help workers learn to make better decisions. Such an algorithm must identify strategies that not only improve worker performance, but that are also interpretable to the human workers so that they can easily understand and follow the tips. We propose a novel machine learning algorithm for inferring interpretable tips that can help users improve their performance in sequential decision-making tasks. We perform a behavioral study to validate our approach. To this end, we designed a virtual kitchen management game that requires the participant to make sequences of decisions to minimize overall service time. Then, we compare the performance of participants shown a tip inferred using our algorithm compared to a control group that is not shown the tip, as well as groups shown either a tip proposed by experienced human workers or a tip inferred by a baseline algorithm. Our experiments show that (i) the tips generated by our algorithm are effective at improving performance, (ii) they significantly outperform the two baseline tips, and (iii) participants do not blindly follow our tip, but incorporate it with their own experience and even build on it to discover additional strategies.

  • Hamsa Bastani (2020), Predicting with Proxies: Transfer Learning in High Dimension, Management Science (Articles in Advance).

    Abstract: Predictive analytics is increasingly used to guide decision-making in many applications. However, in practice, we often have limited data on the true predictive task of interest, and must instead rely on more abundant data on a closely-related proxy predictive task. For example, e-commerce platforms use abundant customer click data (proxy) to make product recommendations rather than the relatively sparse customer purchase data (true outcome of interest); alternatively, hospitals often rely on medical risk scores trained on a different patient population (proxy) rather than their own patient population (true cohort of interest) to assign interventions. However, not accounting for the bias in the proxy can lead to sub-optimal decisions. Using real datasets, we find that this bias can often be captured by a sparse function of the features. Thus, we propose a novel two-step estimator that uses techniques from high-dimensional statistics to efficiently combine a large amount of proxy data and a small amount of true data. We prove upper bounds on the error of our proposed estimator and lower bounds on several heuristics commonly used by data scientists; in particular, our proposed estimator can achieve the same accuracy with exponentially less true data (in the number of features). Our proof relies on a new tail inequality on the convergence of LASSO for approximately sparse vectors. Finally, we demonstrate the effectiveness of our approach on e-commerce and healthcare datasets; in both cases, we achieve significantly better predictive accuracy as well as managerial insights into the nature of the bias in the proxy data.

  • Hamsa Bastani, Mohsen Bayati, Khashayar Khosravi (2020), Mostly Exploration-Free Algorithms for Contextual Bandits, Management Science (Articles in Advance).

    Abstract: The contextual bandit literature has traditionally focused on algorithms that address the exploration-exploitation tradeoff. In particular, greedy algorithms that exploit current estimates without any exploration may be sub-optimal in general. However, exploration-free greedy algorithms are desirable in practical settings where exploration may be costly or unethical (e.g., clinical trials). Surprisingly, we find that a simple greedy algorithm can be rate-optimal (achieves asymptotically optimal regret) if there is sufficient randomness in the observed contexts (covariates). We prove that this is always the case for a two-armed bandit under a general class of context distributions that satisfy a condition we term covariate diversity. Furthermore, even absent this condition, we show that a greedy algorithm can be rate optimal with positive probability. Thus, standard bandit algorithms may unnecessarily explore. Motivated by these results, we introduce Greedy-First, a new algorithm that uses only observed contexts and rewards to determine whether to follow a greedy algorithm or to explore. We prove that this algorithm is rate-optimal without any additional assumptions on the context distribution or the number of arms. Extensive simulations demonstrate that Greedy-First successfully reduces exploration and outperforms existing (exploration-based) contextual bandit algorithms such as Thompson sampling or upper confidence bound (UCB).

  • Pia Ramchandani, Hamsa Bastani, Ken Moon (Under Revision), Responsible Sourcing: The First Step Is the Hardest.

    Abstract: Responsible sourcing is a priority for companies and consumers concerned with corporate social responsibility (CSR) in global supply chains. Most brands' product lines contain just a few products certified by third parties- which suggests that brands limit their efforts at ensuring that suppliers behave responsibly. In this paper, we examine a previously under-appreciated role of certifications: that certifications enable brands to learn about how to source responsibly. By successfully certifying even a single product, the certifying brand may enjoy positive, knowledge-based spillovers encouraging responsible sourcing throughout its product line. Using data on the responsible sourcing decisions of coffee brands in the $48B US consumer market, we find that certifying brands' rates of CSR violations (adjusted for disparities in production volume and detection) are similarly low regardless of whether the brand's portfolio is 3% certified or 100% certified- consistent with learning-based spillover effects. Certifying brands' violation rates are an estimated 61-78% lower than for comparable brands that make no CSR claims. While we find that brands making their own uncertified, on-packaging CSR claims also exhibit low CSR violation rates, their low violation rates are nearly entirely explained by the countries from which they source. In contrast, certifying brands appear uniquely able to source responsibly even from within "high-risk" countries. Our work novelly suggests that prevalent dual-sourcing may surprisingly amplify, rather than limit, responsible sourcing in supply chains, and that certified sourcing valuably develops the pool of responsible suppliers in high-risk countries.

  • Hamsa Bastani and Mohsen Bayati (2019), Online Decision-Making with High-Dimensional Covariates, Operations Research.

    Abstract: Big data have enabled decision makers to tailor decisions at the individual level in a variety of domains, such as personalized medicine and online advertising. Doing so involves learning a model of decision rewards conditional on individual-specific covariates. In many practical settings, these covariates are high dimensional; however, typically only a small subset of the observed features are predictive of a decision’s success. We formulate this problem as a K-armed contextual bandit with high-dimensional covariates and present a new efficient bandit algorithm based on the LASSO estimator. We prove that our algorithm’s cumulative expected regret scales at most polylogarithmically in the covariate dimension d; to the best of our knowledge, this is the first such bound for a contextual bandit. The key step in our analysis is proving a new tail inequality that guarantees the convergence of the LASSO estimator despite the non-i.i.d. data induced by the bandit policy. Furthermore, we illustrate the practical relevance of our algorithm by evaluating it on a simplified version of a medication dosing problem. A patient’s optimal medication dosage depends on the patient’s genetic profile and medical records; incorrect initial dosage may result in adverse consequences, such as stroke or bleeding. We show that our algorithm outperforms existing bandit methods and physicians in correctly dosing a majority of patients.


Current Courses

  • OIDD321 - Intro To Mgmt Science

    Understanding how to use data and business analytics can be the key differential for a company's success or failure. This course is designed to introduce fundamental quantitative decision-making tools for a broad range of managerial decision problems. Topics covered include linear, nonlinear, and discrete optimization, dynamic programming, and simulation. Students will apply these quantitative models in applications of portfolio management, electricity auctions, revenue management for airlines, manufacturing, advertising budget allocation, and healthcare scheduling operations. Emphasis in this course is placed on mathematical modeling of real world problems and implementation of decision making tools.



Past Courses


    This class provides a high-level introduction to the field of judgment and decision making (JDM) and in-depth exposure to the process of doing research in this area. Throughout the semester you will gain hands-on experience with several different JDM research projects. You will be paired with a PhD student or faculty mentor who is working on a variety of different research studies. Each week you will be given assignments that are central to one or more of these studies, and you will be given detailed descriptions of the research projects you are contributing to and how your assignments relate to the successful completion of these projects. To complement your hands-on research experience, throughout the semester you will be assigned readings from the book Nudge by Thaler and Sunstein, which summarizes key recent ideas in the JDM literature. You will also meet as a group for an hour once every three weeks with the class's faculty supervisor and all of his or her PhD students to discuss the projects you are working on, to discuss the class readings, and to discuss your own research ideas stimulated by getting involved in various projects. Date and time to be mutually agreed upon by supervising faculty and students. the 1CU version of this course will involve approx. 10 hours of research immersion per week and a 10-page paper. The 0.5 CU version of this course will involve approx 5 hours of research immersion per week and a 5-page final paper. Please contact Professor Joseph Simmons if you are interested in enrolling in the course: jsimmo@wharton.upenn.edu


    Understanding how to use data and business analytics can be the key differential for a company's success or failure. This course is designed to introduce fundamental quantitative decision-making tools for a broad range of managerial decision problems. Topics covered include linear, nonlinear, and discrete optimization, dynamic programming, and simulation. Students will apply these quantitative models in applications of portfolio management, electricity auctions, revenue management for airlines, manufacturing, advertising budget allocation, and healthcare scheduling operations. Emphasis in this course is placed on mathematical modeling of real world problems and implementation of decision making tools.


    This course number is currently used for several course types including independent studies, experimental courses and Management & Technology Freshman Seminar. Instructor permission required to enroll in any independent study. Wharton Undergraduate students must also receive approval from the Undergraduate Division to register for independent studies. Section 002 is the Management and Technology Freshman Seminar; instruction permission is not required for this section and is only open to M&T students. For Fall 2020, Section 004 is a new course titled AI, Business, and Society. The course provides a overview of AI and its role in business transformation. The purpose of this course is to improve understanding of AI, discuss the many ways in which AI is being used in the industry, and provide a strategic framework for how to bring AI to the center of digital transformation efforts. In terms of AI overview, we will go over a brief technical overview for students who are not actively immersed in AI (topic covered include Big Data, data warehousing, data-mining, different forms of machine learning, etc). In terms of business applications, we will consider applications of AI in media, Finance, retail, and other industries. Finally, we will consider how AI can be used as a source of competitive advantage. We will conclude with a discussion of ethical challenges and a governance framework for AI. No prior technical background is assumed but some interest in (and exposure to) technology is helpful. Every effort is made to build most of the lectures from the basics.


    Seminar on distribution systems models and theory. Reviews current research in the development and solution of models of distribution systems. Emphasizes multi-echelon inventory control, logistics management, network design, and competitive models.

Awards and Honors

  • 1st Place, Pierskalla Award for Best Paper in Healthcare, 2019
  • 2nd Place, Service Science Best Paper Award, 2019
  • People’s Choice Award, Early-Career Sustainable OM Workshop, 2019
  • Finalist, Pierskalla Award for Best Paper in Healthcare, 2018
  • 1st Place, Pierskalla Award for Best Paper in Healthcare, 2016
  • 1st Place, George Nicholson Student Paper Competition, 2016
  • 1st Place, MSOM Student Paper Competition, 2016
  • 1st Place, IBM Service Science Best Student Paper Award, 2016
  • 1st Place, Health Applications Society Best Student Paper Award, 2015

In the News

Knowledge @ Wharton


In the News

How Artificial Intelligence Can Slow the Spread of COVID-19

A new machine-learning approach to COVID-19 testing that was developed by Wharton’s Hamsa Bastani and other experts has produced encouraging results in Greece by identifying more asymptomatic, infected travelers than what conventional random testing would have achieved.

Knowledge @ Wharton - 3/2/2021
All News

Wharton Magazine

Wharton’s Global Impact: From Buenos Aires to Athens
Wharton Magazine - 10/16/2020