mstz commited on
Commit
edbc126
1 Parent(s): 3d00fe0

Update heloc.py

Browse files
Files changed (1) hide show
  1. heloc.py +9 -17
heloc.py CHANGED
@@ -64,9 +64,7 @@ _BASE_FEATURE_NAMES = [
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
- """
70
 
71
  # Dataset info
72
  urls_per_split = {
@@ -115,14 +113,11 @@ class Heloc(datasets.GeneratorBasedBuilder):
115
  DEFAULT_CONFIG = "risk"
116
  BUILDER_CONFIGS = [
117
  HelocConfig(name="risk",
118
- description="Binary classification of trade risk."),
119
  ]
120
 
121
 
122
  def _info(self):
123
- if self.config.name not in features_per_config:
124
- raise ValueError(f"Unknown configuration: {self.config.name}")
125
-
126
  info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
127
  features=features_per_config[self.config.name])
128
 
@@ -136,18 +131,15 @@ class Heloc(datasets.GeneratorBasedBuilder):
136
  ]
137
 
138
  def _generate_examples(self, filepath: str):
139
- if self.config.name == "risk":
140
- data = pandas.read_csv(filepath)
141
- data.columns = _BASE_FEATURE_NAMES
142
- data = self.preprocess(data, config=self.config.name)
143
-
144
- for row_id, row in data.iterrows():
145
- data_row = dict(row)
146
 
147
- yield row_id, data_row
148
- else:
149
- raise ValueError(f"Unknown config: {self.config.name}")
150
 
 
 
151
  def preprocess(self, data: pandas.DataFrame, config: str = "risk") -> pandas.DataFrame:
152
  data = data[list(features_types_per_config["risk"].keys())]
153
 
 
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 = {
 
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
 
 
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