Datasets:
Upload anneal.py
Browse files
anneal.py
CHANGED
@@ -133,7 +133,8 @@ class Anneal(datasets.GeneratorBasedBuilder):
|
|
133 |
downloads = dl_manager.download_and_extract(urls_per_split)
|
134 |
|
135 |
return [
|
136 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]})
|
|
|
137 |
]
|
138 |
|
139 |
def _generate_examples(self, filepath: str):
|
@@ -147,7 +148,7 @@ class Anneal(datasets.GeneratorBasedBuilder):
|
|
147 |
|
148 |
def preprocess(self, data: pandas.DataFrame, config: str = DEFAULT_CONFIG) -> pandas.DataFrame:
|
149 |
data.columns = _BASE_FEATURE_NAMES
|
150 |
-
data.loc[:, "formability"] = data.formability.apply(lambda x: int(x) if x
|
151 |
data.loc[:, "enamelability"] = data.enamelability.apply(lambda x: int(x) if x != "-" else 0)
|
152 |
data.loc[:, "non_ageing"] = data.formability.apply(lambda x: True if x == "-" else False)
|
153 |
data.loc[:, "bc"] = data.bc.apply(lambda x: True if x == "Y" else False)
|
|
|
133 |
downloads = dl_manager.download_and_extract(urls_per_split)
|
134 |
|
135 |
return [
|
136 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]}),
|
137 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloads["test"]})
|
138 |
]
|
139 |
|
140 |
def _generate_examples(self, filepath: str):
|
|
|
148 |
|
149 |
def preprocess(self, data: pandas.DataFrame, config: str = DEFAULT_CONFIG) -> pandas.DataFrame:
|
150 |
data.columns = _BASE_FEATURE_NAMES
|
151 |
+
data.loc[:, "formability"] = data.formability.apply(lambda x: int(x) if x not in ("-", "?") else 0)
|
152 |
data.loc[:, "enamelability"] = data.enamelability.apply(lambda x: int(x) if x != "-" else 0)
|
153 |
data.loc[:, "non_ageing"] = data.formability.apply(lambda x: True if x == "-" else False)
|
154 |
data.loc[:, "bc"] = data.bc.apply(lambda x: True if x == "Y" else False)
|