Counterfactual Plans under Distributional Ambiguity

Counterfactual explanations are attracting significant attention due to the flourishing applications of machine learning models in consequential domains . A counterfactual plan consists of multiple possibilities to modify a given instance so that the model ’ s prediction will be altered . As the predictive model can be updated subject to the future arrival of new data , a counterfactual plan may become ineffective , or infeasible , with respect to the future values of the model parameters . In this work , we study the counterfactual plans under model uncertainty , in which the distribution of the model parameters is partially prescribed using only the first- and second-moment information . First , we propose an uncertainty quantification tool to compute the lower and upper bounds of the probability of validity for any given counterfactual plan . We then provide corrective methods to adjust the counterfactual plan to improve the validity measure . The numerical experiments validate our bounds and demonstrate that our correction increases the robustness of the counterfactual plans in different real-world datasets . 1 INTRODUCTION . Machine learning models , thanks to their superior predictive performance , are blooming with increasing applications in consequential decision-making tasks . Along with the potential to help making better decisions , current machine learning models are also raising concerns about their explainability and transparency , especially in domains where humans are at stake . These domains span from loan approvals ( Siddiqi , 2012 ) , university admission ( Waters & Miikkulainen , 2014 ) to job hiring ( Ajunwa et al. , 2016 ) . In these applications , it is instructive to understand why a particular algorithmic decision is made , and counterfactual explanations act as a useful toolkit to comprehend ( black-box ) machine learning models ( Wachter et al. , 2017 ) . Counterfactual explanation is also known in the field of interpretable machine learning as contrastive explanation ( Miller , 2018 ; Karimi et al. , 2020b ) or recourse ( Ustun et al. , 2019 ) . A counterfactual explanation suggests how an instance should be modified so as to receive an alternate algorithmic outcome . As such , it could be used as a suggestion for improvement purposes . For example , a student is rejected from graduate study , and the university can provide one or multiple counterfactuals to guide the applicant for admission in the following year . A concrete example may be of the form “ get a GRE score of at least 325 ” or “ get a 6-month research experience ” . In practice , providing a counterfactual plan consisting of multiple examples is highly desirable because a single counterfactual to every applicant with the same covariates may be unsatisfactory in practice ( Wachter et al. , 2017 ) . Indeed , the covariates can barely capture the intrinsic behaviors , constraints and unrevealed preferences of the person they represent so that the users with the same features may have different preferences to modify their input . As a consequence , a pre-emptive design choice is to provide a “ menu ” of possible recourses , and let the applicant choose the recourse that fits them best . Viewed in this way , a counterfactual plan has the potential to increase satisfaction and build trust among the stakeholders of any machine learning applications . Constructing a counterfactual plan , however , is not a straightforward task because of the many competing criteria in the design process . By definition , the plan should be valid : by committing to any counterfactual in the plan , the application should be able to flip his current unfavorable outcome to a favorable one . However , each possibility in the plan should be in the proximity of the covariates of the applicant so that the modification is actionable . Further , the plan should consist of a diverse range of recourses to accommodate the different tastes and preferences of the population . Russell ( 2019 ) propose a mixed integer programming method to generate a counterfactual plan for a linear classifier , in which the diversity is imposed using a rule-based approach . In Dandl et al . ( 2020 ) , the authors propose a model-agnostic approach using a multi-objective evolutionary algorithm to construct a diverse counterfactual plan . More recently , Mothilal et al . ( 2020 ) use the determinantal point process to measure the diversity of a plan . The authors then formulate an optimization problem to find the counterfactual plan that minimizes the weighted sum of three terms representing validity , proximity , and diversity . A critical drawback of the existing works is the assumption of an invariant predictive model , which often fails to hold in practical settings . In fact , during a turbulent pandemic time , it is difficult to assume that the demographic population of students applying for postgraduate studies remain unchanged . And even in the case that the demography remains unchanged , special pandemic conditions such as hybrid learning mode or travel bans may affect the applicants ’ package , which in turn leads to fluctuations of the covariate distribution in the applicant pool . These shifts in the data are channeled to the shift in the parameters of the predictive model : when the machine learning models are re-trained or re-calibrated with new data , their parameters also change accordingly ( Venkatasubramanian & Alfano , 2020 ) . This raises an emerging concern because the counterfactual plan is usually designed to be valid to only the current model , but that is not enough to guarantee any validity on the future models . Thus , the counterfactual plan carries a promise of a favorable future outcome , nevertheless , this promise is fragile . It is hence reasonable to demand the counterfactual plan to be robust with respect to the shift of the parameters . Pawelczyk et al . ( 2020 ) study the sparsity of counterfactuals and its non-robustness under different fixed models ( predictive multiplicity ) . Rawal et al . ( 2020 ) consider the counterfactual plan problem and describe several types of model shift related to the correction , temporal , and geospatial shift from data . They also study the trade-off between the recourse proximity and its validity regarding to the model updates . Most recently , Upadhyay et al . ( 2021 ) leverage robust optimization to generate a counterfactual that is robust to some constrained perturbations of the model ’ s parameters . However , both works consider only the single counterfactual settings . Contributions . We study the many facets of the counterfactual plans with respect to random future model parameters . We focus on a linear classification setting and we prescribe the random model parameters only through the first- and second-moment information . We contribute concretely 1. a diagnostic tool to assess the validity of a counterfactual plan . It provides a lower and upper bound on the probability of joint validity of a given plan subject to uncertain model parameters . 2. a correction tool to improve the validity of a counterfactual plan , while keeping the modifications to each counterfactual at a minimal level . The corrections are intuitive and admit closed-form expression . 3. a COunterfactual Plan under Ambiguity ( COPA ) framework to construct a counterfactual plan which explicitly takes the model uncertainty into consideration . It minimizes the weighted sum of validity , proximity and diversity terms , and can be solved efficiently using gradient descents . Each of our above contributions is exposed in Section 2 , 3 and 4 , respectively . In Section 5 , we conduct experiments on both synthetic and real-world datasets to demonstrate the efficiency of our corrections and of our COPA framework . All proofs can be found in the appendix . General setup . Consider a covariate space Rd and a linear binary classification setting . Each linear classifier can be parametrized by θ ∈ Rd with decision output Cθ ( x ) = 1 if θ > x ≥ 0 , and 0 otherwise , where 0 represents an unfavorable outcome . Note that we omit the bias term to avoid clutter , taking the bias term into account can be achieved by extending the dimension of x and θ by an extra dimension . A counterfactual plan is a set of J counterfactual explanations { xj } j=1 , ... , J , and we denote { xj } for short . When J = 1 , we have a single counterfactual explanation problem , which is the subject of recent works ( Ustun et al. , 2019 ; Karimi et al. , 2020a ; Upadhyay et al. , 2021 ) . Next , we define the joint validity of a counterfactual plan . Definition 1.1 ( Joint validity ) . A counterfactual plan { xj } is valid with respect to a realization θ if Cθ ( xj ) = 1 for all j = 1 , . . . , J . Notations . We use Sd++ ( Sd+ ) to denote the space of symmetric positive ( semi ) definite matrices . For any A ∈ Rm×m , the trace operator is Tr [ A ] = ∑d i=1Aii . For any integer J , [ J ] , { 1 , . . . , J } . 2 VALIDITY BOUNDS OF COUNTERFACTUAL PLANS . In this section , we propose a diagnostic tool to benchmark the validity of a pre-computed counterfactual plan { xj } . We model the random model parameters θ̃ with a nominal distribution P̂ . Instead of making a strong assumption on a specific parametric form of P̂ such as Gaussian distribution , we only assume that P̂ is known only up to the second moment . More specifically , we assume that under P̂ , θ̃ has a nominal mean vector µ̂ and nominal covariance matrix Σ̂ ∈ Sd++ . Definition 2.1 ( Gelbrich distance ) . The Gelbrich distance between two pairs ( µ1 , Σ1 ) ∈ Rd × Sd+ and ( µ2 , Σ2 ) ∈ Rd × Sd+ is defined as G ( ( µ1 , Σ1 ) , ( µ2 , Σ2 ) ) , √ ‖µ1 − µ2‖22 + Tr [ Σ1 + Σ2 − 2 ( Σ 1 2 2 Σ1Σ 1 2 2 ) 1 2 ] . The Gelbrich distance is closely related to the optimal transport distance between Gaussian distributions . Indeed , G ( ( µ1 , Σ1 ) , ( µ2 , Σ2 ) ) is equal to the type-2 Wasserstein distance between two Gaussian distributions N ( µ1 , Σ1 ) and N ( µ2 , Σ2 ) ( Gelbrich , 1990 ) . It is thus trivial that G is a distance on Rd×Sd+ , and as a consequence , it is symmetric andG ( ( µ1 , Σ1 ) , ( µ2 , Σ2 ) ) = 0 if and only if ( µ1 , Σ1 ) = ( µ2 , Σ2 ) . Using the Gelbrich distance to design the moment ambiguity set for distributionally robust optimization leads to many desirable properties such as computational tractability and performance guarantees ( Kuhn et al. , 2019 ) . Motivated by this idea , we first construct the following uncertainty set U , { ( µ , Σ ) ∈ Rd × Sd+ : G ( ( µ , Σ ) , ( µ̂ , Σ̂ ) ) ≤ ρ } , which is formally a ρ-neighborhood in the mean vector-covariance matrix space around the nominal moment ( µ̂ , Σ̂ ) . The ambiguity set for the distributions of θ̃ is obtained by lifting U to generate a family of probability measures that satisfy the moment conditions B , { Q ∈ P : ∃ ( µ , Σ ) ∈ U such that Q ∼ ( µ , Σ ) } , . where P is a set of all probability measures supported on Rd and Q ∼ ( µ , Σ ) indicates that Q has mean vector µ and covariance matrix Σ . The central question of this section is : If the distribution of θ̃ belongs to B , what is the probability that a given plan { xj } is valid ? To answer this question , we define the event set Θ ( { xj } ) that contains all model parameter values that renders { xj } jointly valid . Under the definition of a linear model , Θ ( { xj } ) is an intersection of J open hyperplanes of the form Θ ( { xj } ) , { θ ∈ Rd : x > j θ ≥ 0 ∀j ∈ [ J ] } . ( 1 ) We name Θ ( { xj } ) the set of favorable parameters . The probability of validity for a plan under a measure Q is Q ( θ̃ ∈ Θ ( { xj } ) ) . We are interested in evaluating the lower and the upper bound probability that the plan { xj } is valid uniformly over all distributions Q ∈ B . This is equivalent to quantifying the following quantities inf Q∈B Q ( θ̃ ∈ Θ ( { xj } ) ) and sup Q∈B Q ( θ̃ ∈ Θ ( { xj } ) ) . In the remainder of this section , we discuss how to evaluate the bounds for these terms . Lower bound . We denote by Θ◦ the interior of the set Θ , that is , Θ◦ ( { xj } ) , { θ ∈ Rd : x > j θ > 0 ∀j } . Note that all the inequalities defining Θ◦ ( { xj } ) are strict inequalities . By definition , we have Θ◦ ( { xj } ) ⊂ Θ ( { xj } ) , and hence infQ∈B Q ( θ̃ ∈ Θ◦ ( { xj } ) ) ≤ infQ∈B Q ( θ̃ ∈ Θ ( { xj } ) ) . Because Θ◦ ( { xj } ) is an open set , we can leverage the generalized Chebyshev lower bound to evaluate the minimum quantity of Q ( θ̃ ∈ Θ◦ ( { xj } ) ) over all distributions with a given mean and covariance matrix ( Vandenberghe et al. , 2007 ) . Adding moment uncertainty via the set U is obtained by rejoining two minimization layers . The next theorem presents this result . Theorem 2.2 ( Lower bound ) . For any ρ ∈ R+ , µ̂ ∈ Rd and Σ̂ ∈ Sd+ , let L ? be the optimal value of the following semidefinite program L ? = inf 1− ∑ j∈ [ J ] λj s. t. µ ∈ Rd , Σ ∈ Sd+ , C ∈ Rd×d , M ∈ Sd+ λj ∈ R , zj ∈ Rd , Zj ∈ Sd ∀j ∈ [ J ] −x > j zj ≥ 0 , [ Zj zj z > j λj ] 0 ∀j ∈ [ J ] ∑ j∈ [ J ] [ Zj zj z > j λj ] [ M µ µ > 1 ] , [ Σ C C > Σ̂ ] 0 , [ M − Σ µ µ > 1 ] 0 ‖µ̂‖2 − 2µ̂ > µ+ Tr [ M + Σ̂− 2C ] ≤ ρ2 . ( 2 ) Then we have L ? = inf Q∈B Q ( θ̃ ∈ Θ◦ ( { xj } ) ) ≤ inf Q∈B Q ( θ̃ ∈ Θ ( { xj } ) ) . Upper bound . Because Θ ( { xj } ) is a closed set , we can leverage a duality result to evaluate the maximum quantity of Q ( θ̃ ∈ Θ ( { xj } ) ) over all distributions with a given mean and covariance matrix ( Isii , 1960 ) . Adding moment uncertainty via the set U is obtained by invoking the support function of the moment set . This result is presented in the next theorem Theorem 2.3 ( Upper bound ) . For any ρ ∈ R+ , µ̂ ∈ Rd and Σ̂ ∈ Sd+ , let U ? be the optimal value of the following semidefinite program U ? = inf z0 + γ ( ρ 2 − ‖µ̂‖22 − Tr [ Σ̂ ] ) + q + Tr [ Q ] s. t. γ ∈ R+ , z0 ∈ R , z ∈ Rd , Z ∈ Sd+ , q ∈ R+ , Q ∈ Sd+ , λ ∈ RJ+ [ γI − Z γΣ̂ 12 γΣ̂ 1 2 Q ] 0 , [ γI − Z γµ̂+ z γµ̂ > + z > q ] 0 [ Z z z > z0 ] 0 , [ Z z z > z0 − 1 ] ∑ j∈ [ J ] λj [ 0 12xj 1 2x > j 0 ] . Then we have supQ∈B Q ( θ̃ ∈ Θ ( { xj } ) ) ≤ U ? . Thanks to the choice of the Gelbrich distanceG , both optimization problems in Theorems 2.2 and 2.3 are linear semidefinite programs , and they can be solved efficiently by standard , off-the-shelf solvers such as MOSEK to high dimensions ( MOSEK ApS , 2019 ) . Other choices of distance ( divergence ) are also available : for example , one may opt for the Kullback-Leibler ( KL ) type divergence between Gaussian distribution to prescribe U as in Taskesen et al . ( 2021 ) . Unfortunately , the KL divergence will entail a log-determinant term , and the resulting optimization problems are no longer linear programs and are no longer solvable using MOSEK . Equipped with L ? and U ? , we have the bounds L ? ≤ Q ( { xj } is a valid plan ) ≤ U ? ∀Q ∈ B on the validity of the counterfactual plans { xj } under the distributional ambiguity set B. Complementary information . The previous results show that we can compute the lower bound L ? and upper bound U ? for the probability of validity by solving semidefinite programs . We now show that the two quantities L ? and U ? are complementary to each other in a specific sense . Proposition 2.4 ( Complementary information ) . For any instance , either L ? = 0 or U ? = 1 . More specifically , we have : ( i ) If µ̂ ∈ Θ ( { xj } ) , then U ? = 1 , and ( ii ) If µ̂ 6∈ Θ ( { xj } ) , then L ? = 0 . Because L ? and U ? are bounds for a probability quantity , they are only informative when they are different from 0 and 1 . Proposition 2.4 asserts that the upper bound U ? is trivial when µ̂ ∈ Θ ( { xj } ) , while the lower bound L ? becomes trival if µ̂ 6∈ Θ ( { xj } ) . Next , we leverage these insights to improve the validity of a given counterfactual plan .

Summary: This paper studies the effect of uncertainly in the parameters of an ML model used for consequential decision making on the validity, proximity, and diversity of sets of counterfactual explanations (CFE), namely counterfactual plans. In particular, the paper assumes the model parameters are sampled from a distribution would known mean and covariance, and studies the aforementioned metrics of counterfactual plans when the parameter distribution changes in a bounded manner (according to the Gelbrich distance). Beyond a diagnostic tool (providing bounds on how much the parametere distribution can change), the paper presents a method for counterfactual plan correction after having generated a plan (ex-post), and an approach to generate robust counterfactual plans before the fact (ex-ante). Experiments are presented for the proposed methods.