Placing guardrails with feature engineering
In Chapter 7, Anchors and Counterfactual Explanations, we learned that besides race
, the features most prominent in our explanations were age
, priors_count
, and c_charge_degree
. Thankfully, the data is now balanced, so the racial bias attributed to this imbalance is now gone. However, through anchor and counterfactual explanations, we found some troubling inconsistencies. In the case of age
and priors_count
, these inconsistencies were due to how those features were distributed. We can correct issues with distribution through feature engineering, and that way ensure that a model doesn't learn from uneven distributions. In c_charge_degree
's case being categorical, it lacked a discernible order, and this lack of order created unintuitive explanations.
In this section, we will study ordinalization, discretization, and interaction terms, three ways in which you can place guardrails through feature engineering.