/CreditCardDefault

Primary LanguageJupyter Notebook

CreditCardDefault

Dataset Information

This dataset contains information on default payments, demographic factors, credit data, history of payment, and bill statements of credit card clients in Taiwan from April 2005 to September 2005.

Content

There are 25 variables:

  • ID: ID of each client

  • LIMIT_BAL: Amount of given credit in NT dollars (includes individual and family/supplementary credit

  • SEX: Gender (1=male, 2=female)

  • EDUCATION: (1=graduate school, 2=university, 3=high school, 4=others, 5=unknown, 6=unknown)

  • MARRIAGE: Marital status (1=married, 2=single, 3=others)

  • AGE: Age in years

  • PAY_0: Repayment status in September, 2005 (-1=pay duly, 1=payment delay for one month, 2=payment delay for two months, … 8=payment delay for eight months, 9=payment delay for nine months and above)

  • PAY_2: Repayment status in August, 2005 (scale same as above)

  • PAY_3: Repayment status in July, 2005 (scale same as above)

  • PAY_4: Repayment status in June, 2005 (scale same as above)

  • PAY_5: Repayment status in May, 2005 (scale same as above)

  • PAY_6: Repayment status in April, 2005 (scale same as above)

  • BILL_AMT1: Amount of bill statement in September, 2005 (NT dollar)

  • BILL_AMT2: Amount of bill statement in August, 2005 (NT dollar)

  • BILL_AMT3: Amount of bill statement in July, 2005 (NT dollar)

  • BILL_AMT4: Amount of bill statement in June, 2005 (NT dollar)

  • BILL_AMT5: Amount of bill statement in May, 2005 (NT dollar)

  • BILL_AMT6: Amount of bill statement in April, 2005 (NT dollar)

  • PAY_AMT1: Amount of previous payment in September, 2005 (NT dollar)

  • PAY_AMT2: Amount of previous payment in August, 2005 (NT dollar)

  • PAY_AMT3: Amount of previous payment in July, 2005 (NT dollar)

  • PAY_AMT4: Amount of previous payment in June, 2005 (NT dollar)

  • PAY_AMT5: Amount of previous payment in May, 2005 (NT dollar)

  • PAY_AMT6: Amount of previous payment in April, 2005 (NT dollar)

  • default.payment.next.month: Default payment (1=yes, 0=no)

Data

  • The data was downloaded from the UCI Machine Learning Repo

Concepts

Interpretation of classification reports

Precision

Precision is the ability of a classiifer not to label an instance positive that is actually negative. For each class it is defined as as the ratio of true positives to the sum of true and false positives. Said another way, “for all instances classified positive, what percent was correct?”

Recall

Recall is the ability of a classifier to find all positive instances. For each class it is defined as the ratio of true positives to the sum of true positives and false negatives. Said another way, “for all instances that were actually positive, what percent was classified correctly?”

f1 score

The F1 score is a weighted harmonic mean of precision and recall such that the best score is 1.0 and the worst is 0.0. Generally speaking, F1 scores are lower than accuracy measures as they embed precision and recall into their computation. As a rule of thumb, the weighted average of F1 should be used to compare classifier models, not global accuracy.

support

Support is the number of actual occurrences of the class in the specified dataset. Imbalanced support in the training data may indicate structural weaknesses in the reported scores of the classifier and could indicate the need for stratified sampling or rebalancing. Support doesn’t change between models but instead diagnoses the evaluation process.

In This Application :

Accuracy

  • Overall , how often the model predicts correctly defaulters or non-defaulters.

Precision

  • How often is the model correct when it predicts default.

Recall

  • The proportion of actual defaulters that the model will correctly predict as such

Type I error and Type II error

We need to clarify that confussion matrix are not a very good tool to represent the results in the case of largely unbalanced data, because we will actually need a different metrics that accounts in the same time for the selectivity and specificity of the method we are using, so that we minimize in the same time both Type I errors and Type II errors.

Null Hypothesis (H0) - The client will not default.
Alternative Hypothesis (H1) - The client will default.

Type I error - You reject the null hypothesis when the null hypothesis is actually true.
Type II error - You fail to reject the null hypothesis when the the alternative hypothesis is true.

Cost of Type I error - You erroneously presume that the the client will not default, and a true transaction is rejected.
Cost of Type II error - You erroneously presume that the client will default and the applicants transaction is accepted.

The following image explains what Type I error and Type II error are:

And this alternative image explains even better: