Skip to content

Commit

Permalink
more typos
Browse files Browse the repository at this point in the history
  • Loading branch information
jphall663 committed Nov 16, 2019
1 parent fa81320 commit a1f088a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions debugging_resid_analysis_redux.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -2563,7 +2562,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Here, a problem with the model is visible. For people whose most recent repayment status, i.e. `PAY_0` value, is good, `PAY_0 <= 1`, the model appears to struggle to predict default. When the model predicts this type of customer will not default, and they do, this results in large residuals. For people with late most recent payments, `PAY_0 > 1`, the model appears to struggle to predict on-time payment. When the model predicts people with late most recent payments will default, and then they don't, this also causes large residuals. *A mechanism for error* has been indentified: over-emphasis of a feature: `PAY_0 > 2`. These problems could be become worse if market conditions change, such as in a recession, where more people with good payment behavior could default suddenly. "
"Here, a problem with the model is visible. For people whose most recent repayment status, i.e. `PAY_0` value, is good, `PAY_0 <= 1`, the model appears to struggle to predict default. When the model predicts this type of customer will not default, and they do, this results in large residuals. For people with late most recent payments, `PAY_0 > 1`, the model appears to struggle to predict on-time payment. When the model predicts people with late most recent payments will default, and then they don't, this also causes large residuals. *A mechanism for error* has been identified: over-emphasis of a feature: `PAY_0 > 2`. These problems could be become worse if market conditions change, such as in a recession, where more people with good payment behavior could default suddenly. "
]
},
{
Expand Down Expand Up @@ -2602,7 +2601,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The residual profile is not dramatically different for men (`SEX = 1`) and women (`SEX = 2`). The largest magnitude residuals appear for men and for false positve predictions. This does not ensure the model is not discriminatory, but is just a potentially interesting method to augment results from a more rigorous fairness analysis, such as: https://github.com/jphall663/interpretable_machine_learning_with_python/blob/master/dia.ipynb. For instance the women with the highest false positive residuals, would in some sense, be potentially the most discriminated against by the model."
"The residual profile is not dramatically different for men (`SEX = 1`) and women (`SEX = 2`). The largest magnitude residuals appear for men and for false positive predictions. This does not ensure the model is not discriminatory, but is just a potentially interesting method to augment results from a more rigorous fairness analysis, such as: https://github.com/jphall663/interpretable_machine_learning_with_python/blob/master/dia.ipynb. "
]
},
{
Expand Down Expand Up @@ -2661,7 +2660,7 @@
"metadata": {},
"source": [
"#### Small utility functions used to calculate and display different types of errors \n",
"A number of small, tightly coupled utiltiy functions are used to calculate and display the error metrics across the values of important or demographic variables."
"A number of small, tightly coupled utility functions are used to calculate and display the error metrics across the values of important or demographic variables."
]
},
{
Expand Down Expand Up @@ -3706,7 +3705,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Strangely, for the subset of customers where the more complex GBM model is wrong and the GLM model is right, the predictions of two models appear to be inversely correlated. "
"For the subset of customers where the more complex GBM model is wrong and the GLM model is right, the predictions of two models appear to be inversely correlated. "
]
},
{
Expand Down Expand Up @@ -4413,7 +4412,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Here large differences in average Shapley values are visible between low and high residual model predictions. On average, correct model decisions have negative Shapley values, while incorrect decisions have small magnitude Shapley values. If, when issuing a prediction, the Shapley values are low magnitude, the row could be diverted to another model or sent for human processing. Input data, particularly features with large global or local Shapley contributions to loss, could also be corrupted with missing values in hopes of attaining a better model prediction. "
"Here large differences in average Shapley values are visible between low and high residual model predictions. On average, correct model decisions have negative Shapley values, while incorrect decisions have small magnitude Shapley values. If, when issuing a prediction, the Shapley values are low magnitude, the row could be diverted to another model, say the linear benchmark model, or sent for human processing. Input data, particularly features with large global or local Shapley contributions to loss, could also be corrupted with missing values in hopes of attaining a better model prediction. "
]
},
{
Expand Down Expand Up @@ -4521,7 +4520,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Here two features that are globally more important to logloss than to the model predictions are plotted against model residuals. Like directly above, these plots can also be used to find potentially interesting areas of regions of purely high or low residuals, differences in model behavior across demographic segments, or strange patterns indicating possible manipulation of data or model logic."
"Here two features that are globally more important to logloss than to the model predictions are plotted against model residuals. Like directly above, these plots can also be used to find potentially interesting regions of purely high or low residuals, differences in model behavior across demographic segments, or strange patterns indicating possible manipulation of data or model logic. Cluster profiles of this space seem particularly interesting."
]
},
{
Expand Down Expand Up @@ -4903,20 +4902,21 @@
"* Most recent payment is NT dollar 81,690 (high)\n",
"* Credit limit is NT dollar 500,000 (high)\n",
"* Second most recent payment is NT dollar 18,225 (high)\n",
"* Most recent repayment status is `PAID IN FULL` (very good)\n",
"* Third most recent repayment status is `PAID IN FULL` (very good)\n",
"* Most recent repayment status is very good\n",
"* Third most recent repayment status is very good\n",
"\n",
"All of the variables contributing to high logloss for this individual have values that would be considered positive attributes: large payments, high credit limit, and good repayment statuses. Essentially the model is surprised this person defaulted. This could mean that the model is too reliant on repayment statuses, as was seen by plotting residuals against `PAY_0` values, or it may also indicate the model requires more information to make good decisions, likely in the form of additional input variables.\n",
"\n",
"In general, when examing local contributions to logloss, one might consider whether local contributions to predictions and errors are parsimonious or might indicate tampering with the data or model scoring logic or whether protected variables are weighing heavily in a model decision. Also, and although tedious and time-consuming today, one could use sensitivity analysis to understand how changing model inputs could affect model outcomes for different individuals."
"In general, when examining local contributions to logloss, one might consider whether local contributions to predictions and errors are parsimonious or might indicate tampering with the data or model scoring logic or whether protected variables are weighing heavily in a model decision. Also, and although tedious and time-consuming today, one could use sensitivity analysis to understand how changing model inputs could affect model outcomes for different individuals."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### 8.2 Explain LogLoss Residuals with Decision Trees\n",
"A time-tested method of determining if a model is fundementally biased, either missing data or too simple in form, is to determine whether strong patterns exist in the model residuals. One way to determine if these patterns exist is to model the residuals themselves. When the model used is a decision tree or rule-based model, this opens up the possibility of automatically generating rules that indicate when or why a model might be wrong. "
"A time-tested method of determining if a model is fundamentally biased, either missing data or too simple in form, is to determine whether strong patterns exist in the model residuals. One way to determine if these patterns exist is to model the residuals themselves. When the model used is a decision tree or rule-based model, this opens up the possibility of automatically generating rules that indicate when or why a model might be wrong. "
]
},
{
Expand Down

0 comments on commit a1f088a

Please sign in to comment.