Datasets:
Update monks.py
Browse files
monks.py
CHANGED
|
@@ -164,7 +164,6 @@ class Monk(datasets.GeneratorBasedBuilder):
|
|
| 164 |
yield row_id, data_row
|
| 165 |
|
| 166 |
def preprocess(self, data: pandas.DataFrame, config: str = "monks1") -> pandas.DataFrame:
|
| 167 |
-
print(data.head())
|
| 168 |
data.columns = _ORIGINAL_FEATURE_NAMES
|
| 169 |
data.drop("ID", axis="columns", inplace=True)
|
| 170 |
data.drop("empty", axis="columns", inplace=True)
|
|
@@ -172,10 +171,7 @@ class Monk(datasets.GeneratorBasedBuilder):
|
|
| 172 |
data.loc[:, "is_smiling"] = data.is_smiling.apply(bool)
|
| 173 |
data = data[_BASE_FEATURE_NAMES]
|
| 174 |
|
| 175 |
-
print(data.head())
|
| 176 |
for feature in _ENCODING_DICS:
|
| 177 |
-
print(feature)
|
| 178 |
-
print(data[feature].unique())
|
| 179 |
encoding_function = partial(self.encode, feature)
|
| 180 |
data.loc[:, feature] = data[feature].apply(encoding_function)
|
| 181 |
|
|
|
|
| 164 |
yield row_id, data_row
|
| 165 |
|
| 166 |
def preprocess(self, data: pandas.DataFrame, config: str = "monks1") -> pandas.DataFrame:
|
|
|
|
| 167 |
data.columns = _ORIGINAL_FEATURE_NAMES
|
| 168 |
data.drop("ID", axis="columns", inplace=True)
|
| 169 |
data.drop("empty", axis="columns", inplace=True)
|
|
|
|
| 171 |
data.loc[:, "is_smiling"] = data.is_smiling.apply(bool)
|
| 172 |
data = data[_BASE_FEATURE_NAMES]
|
| 173 |
|
|
|
|
| 174 |
for feature in _ENCODING_DICS:
|
|
|
|
|
|
|
| 175 |
encoding_function = partial(self.encode, feature)
|
| 176 |
data.loc[:, feature] = data[feature].apply(encoding_function)
|
| 177 |
|