{'fraction_non_alphanumeric': 0.034828120961488754, 'fraction_numerical': 0.010370896872576894, 'mean_word_length': 4.738413051538747, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Counterfactual fairness: removing direct effects through regularization

Building machine learning models that are fair with respect to an unprivileged group is a topical problem. Modern fairness-aware algorithms often ignore causal effects and enforce fairness through modifications applicable to only a subset of machine learning models. In this work, we propose a new definition of fairness that incorporates causality through the Controlled Direct Effect (CDE). We develop regularizations to tackle classical fairness measures and present a causal regularization that satisfies our new fairness definition by removing the impact of unprivileged group variables on the model outcomes as measured by the CDE. These regularizations are applicable to any model trained using by iteratively minimizing a loss through differentiation. We demonstrate our approaches using both gradient boosting and logistic regression on: a synthetic dataset, the UCI Adult (Census) Dataset, and a real-world credit-risk dataset. Our results were found to mitigate unfairness from the predictions with small reductions in model performance.


INTRODUCTION
One of the most famous concepts in computer science is the one of "garbage in, garbage out". Applied to machine learning algorithms, this phrase captures the concept that the ability to train and the quality of the output from a machine learning model is dependent on the quality of the training data presented to it. Advances in recent decades have resulted in machine learning algorithms that can leverage a larger variety of data types and sources for ever more complex learning tasks. This increased capacity to learn from data also raises risks of incorporating undesired biases from the training data into a machine learning model [36,40]. Furthermore, even when the data is completely unbiased, machine learning systems can produce biased results for specific groups, as can the case where the sensitive groups form a small minority of the training data. This problem goes beyond "bias in, bias out" becoming in the worst case "fairness in, bias out". It has presented itself in a range of domains from credit-risk assessment to determining an individual's propensity for criminal recidivism [10,26], and has attracted the attention of both regulators and the media [30].
After the "fairness through unawareness" paradigm was shown to be flawed [11,14], new approaches to handle discrimination * To whom correspondence should be addressed in machine learning have been explored. Recent advances enable practitioners to specify which groups, usually derived from one or more sensitive attributes, they are concerned about possibly treating unfairly and design a system that ameliorates potential bias (unfairness) in the outputs. These adaptations cover the full pipeline of the machine learning training problem, with the main approaches including pre-processing of the data [6,15,19,41], postprocessing of outputs [18,20,33] and incorporation of fairness constraints directly into the objective function [2,5,7,17,27,42]. Unfortunately, all of these methods suffer from drawbacks [12,23] such as requiring access to sensitive attributes even after model training (an undesirable scenario in many circumstances), ignoring causal structures in the data, and being specific to a particular machine learning algorithm.
These drawbacks pose serious issues for anyone wishing to ensure fairness in their machine learning practices. Firstly, the wide diversity of statistical fairness measures makes it difficult to select an appropriate metric and corresponding fairness-aware algorithm. This is exacerbated by the fact that while many metrics seemingly address the same underlying notion of fairness, those metrics cannot be mathematically optimized simultaneously for a given task [16]. Furthermore, the statistical nature of the metrics make it difficult to discern correlation from causation when examining decisions and addressing fairness bias. The role of causality [9,24,32] when reasoning about fairness should not be understated. It is considered of serious importance by social-choice theorists and ethicists and it has been argued that causal frameworks would decisively improve reasoning about fairness [25]. This has resulted in several causal definitions of fairness that take advantage of the concept of counterfactuals to address the potential unfair causal effects on model outcomes. However, the implementation of these causal worldviews typically focused on generative models and not on how causality may be incorporated into popular discriminative machine learning models. Moreover, there is a general lack of comparison between models constrained by statistical fairness metrics and causal effects.
In this paper, we address each of the presented issues in turn within a Counterfactual Fairness framework. In this framework, we first describe a novel definition of fairness that seeks to remove the controlled direct effect (CDE) of the sensitive attribute from the model's predictions. We then propose to enforce such definition through regularization. This is achieved through propensity-score matching [34,35] and the development of a mean-field theory. Our fairness-via-regularization approach is applicable to any model trained by minimizing a loss function through differentiation. We will focus on the case of binary classification, with a single binary indicator defining un-/privileged groups, and are exemplified using gradient boosted trees and logistic regression.
To further allow evaluation of our Counterfactual Fairness regularization framework, we compare its results against a regularization strategy aimed at satisfying full equality of outcomes between groups. This allows us to highlight how the differences between these worldviews manifest in the optimized model.
The effectiveness and drawbacks of our methods are illustrated using a public benchmark dataset, a private commercial creditrisk dataset, and a synthetic dataset. The inclusion of a private commercial credit-risk dataset provides insight into how these approaches could work in an industrial setting. We consider this form of evaluation to be of critical importance, as the main risks of machine learning fairness are beared by end-consumers and businesses through high-velocity decisioning systems built on such datasets.
The structure of the papers is as follows: in Section 2 we introduce our notation, in Section 3 we provide a background on some key concepts of causality and mediation effects, in Section 4 we provide a discussion on algorithmic fairness, while in Section 5 we present our regularization strategies. We discuss the results of the experiments in Section 6 and relationships with existing literature in Section 7. Finally, we state our conclusions in Section 8.

NOTATION AND SETTING
Before beginning our discussions on how fairness is measured and the connection to causal modelling, we introduce our notation. We use Y to refer to the observed label in the data while the sensitive attribute is denoted Z . Throughout this work, our groups of interest will be defined by a single, binary sensitive attribute and we only consider binary classification tasks, i.e. Y , Z ∈ {0, 1}. We denote the covariates that do not define the groups of interest (the insensitive covariates) by X. We denote probabilities with P(•) and probability densities with p(•). We assume that our models provide probability estimatesỸ = P(Y = 1|X), andŶ ∈ {0, 1} are the binary outcomes obtained by thresholdingỸ .

BACKGROUND ON CAUSALITY
The aim of this section is to introduce counterfactual quantities and causal effects, especially mediated ones. We follow the causality literature in denoting counterfactual quantities using subscripts, i.e. we define the counterfactual outcome Y (Z =Z * , X=X * ) as the outcome that would have been realized had an individual been assigned the values Z = Z * and X = X * . We assume an unconfounded causal graph of the form of Fig. 1, which embeds our assumption of sequential ignorability: Assumption 1. (Sequential ignorability) The following conditional independence relations hold for each realization Z * and X * : The former of the above conditions is equivalent to assuming the absence of confounders that would open a "backdoor" path between Z and Y [32]. We argue that for our purposes the absence of such paths is justifiable in a wide variety of cases, as the sensitive attribute is usually measured at birth, and is therefore naturally a parent variable.
To avoid cases in which the protected attribute is completely specified by the mediators, we also assume the following: Assumption 2. (Strong ignorability) There is overlap between the two groups: 0 < P(Z = 1|X) < 1, ∀X.
We start by defining the Average Treatment Effect (ATE): where the second line is a consequence of Sequential ignorability and the law of counterfactuals [32] The ATE represents the total causal effect of the protected attribute. In this work, as we shall see in the next section, we are interested in mediation effects, i.e. direct and indirect effects, instead of the ATE. We define the point-wise Controlled Direct Effect (CDE) as: where, as before, the second line follows from Sequential ignorability. The CDE represents the effect of changing the value of the protected attribute while keeping the value of the covariates fixed. Eq. 3 provides a means for directly estimating the CDE from the data, e.g., via regression techniques [3,37].
Another important mediation effect is the Natural Direct Effect (NDE), defined as follows. Given a "baseline" value Z * for the protected attribute, e.g. "female" for a gender discrimination problem, we define the NDE as the difference in Y that would be attained by changing Z , with the value of the mediating variables X set to what they would have attained had Z been Z * , i.e. X Z * . This yields: where the second line is proved in Ref. [31]. The natural direct effect has a few nice properties. First, it has straightforward implications in discrimination problems. Second, contrary to the CDE case, it has an indirect counterpart, namely the Natural Indirect Effect (NIE), defined as: The NIE is easily interpreted as the effect on the baseline population's response of changing X to the value it would have naturally obtained in the non-baseline population while keeping the value of the protected attribute fixed.
Natural direct and indirect effects are, in contrast with the CDE, population-wide quantities and depend on the choice of a baseline value for the protected attribute.
We conclude this section by citing two equalities derived by Pearl [31], which will be useful later and describe the relation between ATE and Natural mediated effects:

ALGORITHMIC FAIRNESS 4.1 Statistical Fairness
The traditional definitions of algorithmic fairness are statistical in nature and reflect underlying worldviews on how the "true" unmeasured target is recorded, its relationship to Z and how it is predicted by a machine learning model. In this framework, statistical measures are derived from one's belief of the latent space structure [16] rather than by specifying causal pathways between the unobserved "true" label and the collected data. Under this construct, two prevailing worldviews of statistical fairness emerge: "We're all equal" and "What you see is what you get". The former focusses on outcomes defined by group membership and seeks to ensure groups are treated equally through balanced outcomes. Contrastingly, the latter favours is a worldview where the data is accurate and so it seeks to offer similar individuals similar outcomes as informed by the data. We focus here on one of the most popular fairness metrics, namely statistical parity difference.
SPD is a group fairness measure on an algorithm's outcome,Ŷ , and it is 0 (maximally fair) only when P[Ŷ = 1|Z = 1] = P[Ŷ = 1|Z = 0]. It is defined as follows: We note that this measure can also be applied to the data by chang-ingŶ to Y in Equation 7. As there is no link between the algorithm outcome and measurement, this difference can be minimized by changing the outcomes of members of each group independent of all other attributes and so can be viewed as a "lazy penalization".

Causal Modelling and Fairness
The measures of fairness presented in the Section 4.1 emerge from a priori worldviews on how the underlying "true" label is related to Z and the veracity of the recorded data. They do not formally encode the causal relationships between the Z , X and Y . Consequently, how much causal effect onŶ can be attributed to Z , either directly or indirectly, is handled implicitly in the worldview employed. The need to explicitly distinguish between direct and indirect effect is well illustrated by the 1973 University of California, Berkeley gender discrimination scandal [4]. In that case, the data showed significant bias in admissions for male and female applicants. However, after controlling for the department chosen by the applicants, that bias disappeared. It was actually found that female applicants had lower overall admission rates not because they were discriminated against, but simply because they were applying to more competitive departments.
In the Counterfactual Fairness worldview we examine here, we are only concerned with biases that are consequences of direct effects. Specifically, we seek to identify, and correct for, how much an outcome for an individual assigned a specific value of Z would change compared to a counterfactual world where they had been assigned the alternative value for Z but all other factors had remained the same [1].
This worldview requires in-depth understanding of the data collection and generation process. In particular, it is important to define what information can be recorded in X. We require that variables X are "fair" in the sense specified by the following requirements: (1) They were not measured before Z .
(2) They do not, either individually or in combination, directly measure discriminatory attributes. (3) They are relevant to the problem at hand. For example, in a financial application where the sensitive attribute is race, "income" would be typically considered fair while "race of the applicant's mother" or "blood pressure" would not be. Taking all of this together, we propose the following definition: Definition 1. (Counterfactual Fairness) Given a set of fair covariates X, a sensitive attribute Z and a target Y , a fair model is a model that does not learn the controlled direct effect of Z on Y .
We stress that any effect mediated by unobserved variables or variables not included in X during training will be embedded in the CDE and hence the X will determine the size of the bias we seek to remove.
We finally note that our definition can be seen as an instance of path-specific counterfactual fairness [9,29,39,43] with the additional requirements on the covariates X highlighted above.

FAIR LOSSES
To improve the fairness aspects of a model's output, in both the Statistical Fairness (Sec. 4.1) and Counterfactual Fairness (Sec. 4.2) worldviews, we modify the loss function and apply regularization. The modifications to the loss function can be applied to all algorithms trained by iteratively minimizing a loss through differentiation, e.g. through gradient descent or gradient boosting.
We combine an original loss function (L o ), which captures our utility objectives, with a fairness penalty (R f ) using a regularization weight (λ). The generic form of fairness-aware loss function (L f ) is as follows: where the modifications R f are differentiable. As we're focussing on binary classification, we take L o to be the binary cross-entropy of Y andỸ . It is important to note that Z is only required at training time to evaluate R f and is not required for prediction. This is a very useful feature for real-world applications, as obtaining Z can be difficult.

Statistical Fairness Regularization
For illustrative purposes and to compare our causal worldview with the statistical "we are all equal" one, we propose a very simple loss aimed at reducing the SPD of the average scores:

Counterfactual Fairness Regularization
To satisfy Definition 1, the CDE must not be learned by the model. The point-wise CDE is given by Eq. (3), which can be estimated using regression techniques [3,37]. However, our algorithm, as we shall see, would require us to fit such regressions iteratively, which can be computationally inefficient if we condition on the full set of covariates. To circumvent this possible computational bottleneck, we employ a "balancing score". Balancing scores are functions b(X) of the covariates that make X and Z conditionally independent, i.e.: In our work we use one such score, namely the "propensity score" b(X) = P(Z = 1|X). Traditionally this score is utilized in scenarios where X play the role of confounders rather than mediators. Although the latter case is true in our instance, utilizing the propensity score solves our key computation problem whenever Assumptions 1 and 2 are true. Given assumptions 1 and 2, we can define a "mean field" CDE given by: The second line of Eq. (11) is proven in Appendix A. The MFCDE can thus be interpreted as an average of the CDE across a volume with constant b = b * . We also note that, as in a classic result by Rosenbaum and Rubin [34] which we extend to the CDE in Appendix A, the population-wide averages of MFCDE and CDE are the same, i.e.
A stronger statement can be made about the MFCDE if we assume the following: This allows us to approximate the MFCDE with the point-wise CDE, i.e. CDE(X) ≃ MFCDE(b(X)). A key result is then that minimization of the CDE (per Counterfactual Fairness) is approximately equivalent to minimizing the MFCDE. Thus, our goal is now to iteratively train a model conditioned on the fair covariates X only and which does not learn the MFCDE.
As a first step, we use our training data to estimate E[Y |Z , b] with a regression model such as: for arbitrary N 1 and N 2 . We then use this to define a "fair" target Y f such that: where we used the fact that MFCDE(b) = N 2 k =0 β k b k and, employing the indicator function I (•), we defined Y f is easily interpreted as a version of a target corrected by a symmetrized version of the CDE, where privileged and unprivileged groups receive anti-symmetrical corrections. We can also show (see Appendix A) that: meaning that the ATE of Z on Y f is equal to symmetric version of the indirect effect on Y , thereby justifying the definition of fair target. Having defined our "fair" target, and how it relates to the MFCDE (hence, to the CDE), we now describe the procedure to remove the CDE during model training. Firstly, at each iteration of the optimization algorithm, we extract the probability scores estimated by our model at that iteration, the balancing scores and the protected attributes for each training example to define a surrogate training set {(Ỹ i , b i , Z i )}. Then, we use this latter to estimate the coefficients of surrogate model: To remove the direct effect, we want to limit the coefficients of this surrogate model to those of the fair target Y f . Our aim will then be to achieveβ k → 0 and, for k > 0, |α k | < |γ k |, which leads us to the following loss: In order for our loss to be differentiable, we require that the coefficientsα k andβ k are estimated as functions which can be differentiated w.r.t. all theỸ i . In our experiments, we used Ordinary Least Square (OLS) regression. Although a wide array of models can be used to define R CDE f , we recommend that the selected model is collapsible [28,38] in order to give the correct causal interpretation to the coefficient.
We emphasize how computing the OLS regression coefficients has a complexity that scales quadratically with the number of covariates. This means that, especially in cases where the number of covariates X is large, as is often the case in today's applications, our mean field solution allows for a dramatic speed-up.

EXPERIMENTS
We evaluated our algorithms on three binary classification tasks using a synthetic dataset, which we included for illustrative purposes, the UCI adult dataset [13], and a commercial credit-risk dataset . We briefly describe these datasets in Section 6.1 and provide a summary in Table 1.
For each dataset, algorithm and loss, we computed results by sweeping the regularization parameter λ from 0 to 0.975 using a step size of 0.025. We evaluated every model trained by its fairness, as measured by SPD, and accuracy (or precision, for the credit-risk models). For the synthetic dataset, we evaluated our results using only logistic regression, while on the other two datasets we used both logistic regression and XGBoost [8].
For the synthetic dataset, we show results for both the SPD loss [Eq. (9)], and CDE loss [Eq. (18)], comparing how the results highlight the differences in worldviews that these losses entail for a problem for which we know the causal story. Contrastingly, for the adult and credit-risk we only display results for the CDE loss.
We employed logistic regression with L 1 loss to estimate the propensity scores b. We also mention that, for higher values of λ, we found it beneficial to first pre-train our models using small values of λ until convergence, and only after that slowly increase λ up to the desired value.
We note that our losses are twice differentiable and we supply the diagonal of the Hessian during training to the XGBoost algorithm in every case.

Datasets
6.1.1 Synthetic Data. We generated a synthetic dataset mimicking the graph of Fig. (1). We sampled the protected attribute out of a Bernoulli distribution and three sets of covariates: "safe" covariates X s ∼ N (0, 1), "proxy" covariates and "indirect effect" covariates sampled from X p , X i ∼ N (Z , 1). We then define the log-odds of the binary target as S Y = 0.25w · (X i + X s ) + 1.25Z . Here, w is a vector of ones. We finally sample Y ∼ Bern 1 1+e −S Y . For our experiments, we used 10 safe, 4 indirect effect and 2 proxy variables.

UCI Adult Dataset.
For this dataset, the goal is to predict whether a person will have an income below or above 50K USD. In this dataset, we are interested in removing gender bias and so we consider gender as our protected attribute. Furthermore, we excluded the following additional sensitive attributes: race, marital status, native country and relationship from our models. The other covariates primarily relate to financial information, occupation and education.

Private Credit-Risk Dataset.
In this dataset, we are trying to infer the probability that a customer will not default on their credit given curated information on their current account transactions. Here, we're interested in removing bias related to age. We binarized the age variable dividing our examples in two groups, an "older" group of people over 50 and an "younger" group of people under 50.

Results
Results for the synthetic dataset and logistic regression models are shown in Fig. 2. We observe that, as we sweep λ → 1, the accuracy of the CDE loss is generally higher than that of the SPD loss, while the SPD is higher. This can be explained by the fact that SPD loss enforces a far more stringent view on fairness than the CDE loss, as it removes both average direct and indirect effects. The SPD loss converges to an almost ideal performance in its target fairness metric. In the bottom panel, which is our main result for this dataset, we show coefficients of the logistic regression model plotted against the regularization strength λ. We find that the coefficients of the variables that were constructed to be correlated both with the target Y and the protected attribute Z (indirect effect variables) and of those correlated with Z alone (proxy variables) become smaller as the fairness regularization increases. Furthermore, we observe that the coefficient changes with λ reflect the different worldviews described in Section 4. The CDE loss is very faithful to the original causal story (see Section 6.1.1), where the causal sampling coefficients of the fair and indirect effect variables are the same and the coefficients of the proxy variables are zero. Contrastingly, the SPD loss cause the coefficients to converge to values very different from the ones of the data generating distribution, which in this worldview is in itself deemed "unfair". Results for the UCI Adult dataset are shown in Fig. 3. For this dataset, referring to Eq. (18), we used N 1 = N 2 = 1. For the XGBoost models, we observe that, as λ is increased, accuracy drops by a tolerable amount, i.e. from roughly 0.85 at λ = 0 to roughly 0.83 at λ = 0.975. At the same time, SPD is reduced from 0.10 to 0.06. Results for logistic regression are more nuanced: accuracy goes from 0.82 to 0.81, while SPD decreases from 0.09 to 0.07. In the bottom panel we show how the coefficients of the surrogate model [see Eq. (17)] change as λ increases. We notice howα 1 converges to its target γ 1 while theβ i coefficients approach zero.
Finally, in Fig. 4 we show results for the credit-risk dataset. Here we used N 1 = 1, N 2 = 0. Also, we tailored our results to the specificity of the credit-risk problem, where usually people are approved when their default probability is very low. We therefore used a threshold of 0.85 and, since we are more interested in the cost of false positives than the one of false negatives, we evaluate the performances of the model using precision. Results for XGBoost show that precision went from 0.96 to 0.89, while SPD went from 0.28 to 0.09. Logistic regression did not seem particularly affected by the regularization. In this case, precision went from 0.86 to 0.85, while SPD dropped from 0.05 to 0.04. To explain this observation, we conjecture that logistic regression does not have enough statistical capacity to absorb the direct effect when it's not directly exposed to the protected attribute Z . Results for the surrogate coefficients (bottom panel) show how the XGBoost models display generally good convergence.

RELATED WORK
There has been significant advancement in the areas of incorporating fairness into machine learning algorithms and the role of causality in fairness.
Training fair models: In Ref. [42], a fair neural network was built through the use of an adversarial model that tries to predict the sensitive attribute from the model outputs. Similarly, Ref. [27] developed statistical fairness regularizations to debias neural networks. The form of these regularizations restricted them to neural networks. Ref. [17] incorporate convex regularizations directly into training a fair logistic regression, but this approach relies on empirical weights to represent historical bias and is directly related to proportionally fair classification rather than a traditional fairness measure. Other approaches have instead posed the problem as one of constrained optimization while others still have used multiple models to remove bias [5,21]. Here, we propose novel regularizations that are applicable to any model trained using gradient-based optimizers and are designed to target both the classic and causal metrics directly in the scores.
Causal Fairness: Several works have recently addressed the problem of tackling some definition of counterfactual fairness [22,24]. In Refs. [9,29,39,43] the problem of identifying and removing path specific effects is studied. Those papers consider generative (or partly generative [29]) models. Since direct effects are particular cases of path specific effects, the scope of those works is somewhat bigger than ours but, crucially, they do not provide a generic method for incorporation of such effects into standard discriminative machine learning models. Our proposal also benefits from being model-agnostic. Furthermore, to compare our worldview with these path-specific works, we borrow an example from [29]. In this example, the influence of gender on hiring outcomes for a white collar job might be considered fair through a variable such as education, and unfair through a variable such as physical strength.
Here, we argue that for most practical purposes our definition of fair covariates X (see Section 4.2) should suggest that physical strength should not be selected among the X as it easily arguable that it itself is discriminatory attribute and is irrelevant to the problem: one might not want to discriminate between stronger and weaker people for this particular application, regardless on the effect that gender has on it. This combination of what variables are deemed fair individually irrespective of the pathway in conjunction with the CDE makes our worldview particularly novel and applicable in many industrial settings.

CONCLUSIONS
In this work, we extended the literature by proposing a new definition of fairness that focuses on the removal of the controlled direct effect and is causal in nature. Incorporating causal effects into notions of fairness is crucial [4], and we argue that our definition is intuitive and general. We demonstrated how to enforce it through the use of a regularization term. Our solution is particularly appealing with respect to existing ones because it is applicable to any model that uses gradient-based optimization, including popular discriminative models. We exemplified our approaches on three datasets using XGBoost and logistic regression. In all cases, our framework allowed for a realistic trade-off between fairness and predictive performance.

ACKNOWLEDGEMENTS
We are indebted to C. Dhanjal, F. Bellosi, G. Jones and L. Stoddart for fruitful discussions. We also wish to acknowledge Experian Ltd and J. Campos Zabala for supporting this work.

A BALANCING SCORES AND MEDIATION EFFECTS
In this Appendix, we wish to justify Eq. (11), (12) and (16). Eq. (11) is proven below. Theorem 1. If Assumptions 1 and 2 hold, then, if b(X) is a balancing score, the second line of Eq. (11) holds.
Proof. In order to prove our hypothesis, it is sufficient to show that We have: Where line 4 follows from p(X|b) = I (X ∈ X b ) p(X)/ ∫ X b dX p(X). The final line follows from the definition of the balancing score. □ In order to justify Eqs. (12) and (16) we also need to prove the following: Theorem 2. Under the assumptions of Theorem 1, the following equations hold: Proof. The proof of Eqs. (20) and (21) are very similar. We'll prove Eq.
P(Z = Z ′ |X, b(X))p(X) P(Z = Z ′ |b(X))p(b(X)) p(b(X)|Z = Z * )) where line 3 follows from two applications of Bayes' rule, δ (•) in line 4 is Dirac's delta distribution, line 5 follows from integrating b out, line 6 again from Bayes' rule and the definition of a balancing score, which entails P(Z |b(X)) = P(Z |(X); the final line follows straightforwardly, from a reverse application of Bayes' rule. □ Eq. (16) is then derived from Eqs. (21) and (6) with minimal algebra.