Datasets:
Tasks:
Tabular Classification
Modalities:
Tabular
Formats:
csv
Languages:
English
Size:
10K - 100K
License:
updated to datasets 4.*
Browse files
README.md
CHANGED
|
@@ -1,19 +1,20 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
tags:
|
| 5 |
-
- heloc
|
| 6 |
-
- fico
|
| 7 |
- tabular_classification
|
| 8 |
- binary_classification
|
| 9 |
-
|
| 10 |
-
size_categories:
|
| 11 |
-
- 10K<n<100K
|
| 12 |
task_categories:
|
| 13 |
- tabular-classification
|
| 14 |
-
configs:
|
| 15 |
-
- risk
|
| 16 |
-
license: cc
|
| 17 |
---
|
| 18 |
# HELOC
|
| 19 |
The [HELOC dataset](https://community.fico.com/s/explainable-machine-learning-challenge?tabset-158d9=d157e) from FICO.
|
|
|
|
| 1 |
---
|
| 2 |
+
configs:
|
| 3 |
+
- config_name: risk
|
| 4 |
+
data_files:
|
| 5 |
+
- path: risk/train.csv
|
| 6 |
+
split: train
|
| 7 |
+
default: true
|
| 8 |
+
language: en
|
| 9 |
+
license: cc
|
| 10 |
+
pretty_name: Heloc
|
| 11 |
+
size_categories: 1M<n<10M
|
| 12 |
tags:
|
|
|
|
|
|
|
| 13 |
- tabular_classification
|
| 14 |
- binary_classification
|
| 15 |
+
- multiclass_classification
|
|
|
|
|
|
|
| 16 |
task_categories:
|
| 17 |
- tabular-classification
|
|
|
|
|
|
|
|
|
|
| 18 |
---
|
| 19 |
# HELOC
|
| 20 |
The [HELOC dataset](https://community.fico.com/s/explainable-machine-learning-challenge?tabset-158d9=d157e) from FICO.
|
heloc.csv
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
heloc.py
DELETED
|
@@ -1,148 +0,0 @@
|
|
| 1 |
-
"""Heloc Dataset"""
|
| 2 |
-
|
| 3 |
-
from typing import List
|
| 4 |
-
|
| 5 |
-
import datasets
|
| 6 |
-
|
| 7 |
-
import pandas
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
VERSION = datasets.Version("1.0.0")
|
| 11 |
-
_ORIGINAL_FEATURE_NAMES = [
|
| 12 |
-
"RiskPerformance",
|
| 13 |
-
"ExternalRiskEstimate",
|
| 14 |
-
"MSinceOldestTradeOpen",
|
| 15 |
-
"MSinceMostRecentTradeOpen",
|
| 16 |
-
"AverageMInFile",
|
| 17 |
-
"NumSatisfactoryTrades",
|
| 18 |
-
"NumTrades60Ever2DerogPubRec",
|
| 19 |
-
"NumTrades90Ever2DerogPubRec",
|
| 20 |
-
"PercentTradesNeverDelq",
|
| 21 |
-
"MSinceMostRecentDelq",
|
| 22 |
-
"MaxDelq2PublicRecLast12M",
|
| 23 |
-
"MaxDelqEver",
|
| 24 |
-
"NumTotalTrades",
|
| 25 |
-
"NumTradesOpeninLast12M",
|
| 26 |
-
"PercentInstallTrades",
|
| 27 |
-
"MSinceMostRecentInqexcl7days",
|
| 28 |
-
"NumInqLast6M",
|
| 29 |
-
"NumInqLast6Mexcl7days",
|
| 30 |
-
"NetFractionRevolvingBurden",
|
| 31 |
-
"NetFractionInstallBurden",
|
| 32 |
-
"NumRevolvingTradesWBalance",
|
| 33 |
-
"NumInstallTradesWBalance",
|
| 34 |
-
"NumBank2NatlTradesWHighUtilization",
|
| 35 |
-
"PercentTradesWBalance",
|
| 36 |
-
]
|
| 37 |
-
_BASE_FEATURE_NAMES = [
|
| 38 |
-
"is_at_risk",
|
| 39 |
-
"estimate_of_risk",
|
| 40 |
-
"months_since_first_trade",
|
| 41 |
-
"months_since_last_trade",
|
| 42 |
-
"average_duration_of_resolution",
|
| 43 |
-
"number_of_satisfactory_trades",
|
| 44 |
-
"nr_trades_insolvent_for_over_60_days",
|
| 45 |
-
"nr_trades_insolvent_for_over_90_days",
|
| 46 |
-
"percentage_of_legal_trades",
|
| 47 |
-
"months_since_last_illegal_trade",
|
| 48 |
-
"maximum_illegal_trades_over_last_year",
|
| 49 |
-
"maximum_illegal_trades",
|
| 50 |
-
"nr_total_trades",
|
| 51 |
-
"nr_trades_initiated_in_last_year",
|
| 52 |
-
"percentage_of_installment_trades",
|
| 53 |
-
"months_since_last_inquiry_not_recent",
|
| 54 |
-
"nr_inquiries_in_last_6_months",
|
| 55 |
-
"nr_inquiries_in_last_6_months_not_recent",
|
| 56 |
-
"net_fraction_of_revolving_burden",
|
| 57 |
-
"net_fraction_of_installment_burden",
|
| 58 |
-
"nr_revolving_trades_with_balance",
|
| 59 |
-
"nr_installment_trades_with_balance",
|
| 60 |
-
"nr_banks_with_high_ratio",
|
| 61 |
-
"percentage_trades_with_balance"
|
| 62 |
-
]
|
| 63 |
-
|
| 64 |
-
DESCRIPTION = "Heloc dataset for trade insolvency risk prediction."
|
| 65 |
-
_HOMEPAGE = "https://community.fico.com/s/explainable-machine-learning-challenge?tabset-158d9=ca01a"
|
| 66 |
-
_URLS = ("https://community.fico.com/s/explainable-machine-learning-challenge?tabset-158d9=ca01a")
|
| 67 |
-
_CITATION = """"""
|
| 68 |
-
|
| 69 |
-
# Dataset info
|
| 70 |
-
urls_per_split = {
|
| 71 |
-
"train": "https://huggingface.co/datasets/mstz/heloc/raw/main/heloc.csv",
|
| 72 |
-
}
|
| 73 |
-
features_types_per_config = {
|
| 74 |
-
"risk": {
|
| 75 |
-
"estimate_of_risk": datasets.Value("int8"),
|
| 76 |
-
"months_since_first_trade": datasets.Value("int32"),
|
| 77 |
-
"months_since_last_trade": datasets.Value("int32"),
|
| 78 |
-
"average_duration_of_resolution": datasets.Value("int32"),
|
| 79 |
-
"number_of_satisfactory_trades": datasets.Value("int16"),
|
| 80 |
-
"nr_trades_insolvent_for_over_60_days": datasets.Value("int16"),
|
| 81 |
-
"nr_trades_insolvent_for_over_90_days": datasets.Value("int16"),
|
| 82 |
-
"percentage_of_legal_trades": datasets.Value("int16"),
|
| 83 |
-
"months_since_last_illegal_trade": datasets.Value("int32"),
|
| 84 |
-
"maximum_illegal_trades_over_last_year": datasets.Value("int8"),
|
| 85 |
-
"maximum_illegal_trades": datasets.Value("int16"),
|
| 86 |
-
"nr_total_trades": datasets.Value("int16"),
|
| 87 |
-
"nr_trades_initiated_in_last_year": datasets.Value("int16"),
|
| 88 |
-
"percentage_of_installment_trades": datasets.Value("int16"),
|
| 89 |
-
"months_since_last_inquiry_not_recent": datasets.Value("int16"),
|
| 90 |
-
"nr_inquiries_in_last_6_months": datasets.Value("int16"),
|
| 91 |
-
"nr_inquiries_in_last_6_months_not_recent": datasets.Value("int16"),
|
| 92 |
-
"net_fraction_of_revolving_burden": datasets.Value("int32"),
|
| 93 |
-
"net_fraction_of_installment_burden": datasets.Value("int32"),
|
| 94 |
-
"nr_revolving_trades_with_balance": datasets.Value("int16"),
|
| 95 |
-
"nr_installment_trades_with_balance": datasets.Value("int16"),
|
| 96 |
-
"nr_banks_with_high_ratio": datasets.Value("int16"),
|
| 97 |
-
"percentage_trades_with_balance": datasets.Value("int16"),
|
| 98 |
-
"is_at_risk": datasets.ClassLabel(num_classes=2, names=("no", "yes"))
|
| 99 |
-
}
|
| 100 |
-
|
| 101 |
-
}
|
| 102 |
-
features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
class HelocConfig(datasets.BuilderConfig):
|
| 106 |
-
def __init__(self, **kwargs):
|
| 107 |
-
super(HelocConfig, self).__init__(version=VERSION, **kwargs)
|
| 108 |
-
self.features = features_per_config[kwargs["name"]]
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
class Heloc(datasets.GeneratorBasedBuilder):
|
| 112 |
-
# dataset versions
|
| 113 |
-
DEFAULT_CONFIG = "risk"
|
| 114 |
-
BUILDER_CONFIGS = [
|
| 115 |
-
HelocConfig(name="risk",
|
| 116 |
-
description="Binary classification of trade risk.")
|
| 117 |
-
]
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
def _info(self):
|
| 121 |
-
info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
|
| 122 |
-
features=features_per_config[self.config.name])
|
| 123 |
-
|
| 124 |
-
return info
|
| 125 |
-
|
| 126 |
-
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
| 127 |
-
downloads = dl_manager.download_and_extract(urls_per_split)
|
| 128 |
-
|
| 129 |
-
return [
|
| 130 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]}),
|
| 131 |
-
]
|
| 132 |
-
|
| 133 |
-
def _generate_examples(self, filepath: str):
|
| 134 |
-
data = pandas.read_csv(filepath)
|
| 135 |
-
data.columns = _BASE_FEATURE_NAMES
|
| 136 |
-
data = self.preprocess(data, config=self.config.name)
|
| 137 |
-
|
| 138 |
-
for row_id, row in data.iterrows():
|
| 139 |
-
data_row = dict(row)
|
| 140 |
-
|
| 141 |
-
yield row_id, data_row
|
| 142 |
-
|
| 143 |
-
def preprocess(self, data: pandas.DataFrame, config: str = "risk") -> pandas.DataFrame:
|
| 144 |
-
data = data[list(features_types_per_config["risk"].keys())]
|
| 145 |
-
|
| 146 |
-
data.loc[:, "is_at_risk"] = data.is_at_risk.apply(lambda x: 1 if x == "Bad" else 0)
|
| 147 |
-
|
| 148 |
-
return data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
risk/train.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|