Datasets:
Upload student_performance.py
Browse files- student_performance.py +4 -4
student_performance.py
CHANGED
|
@@ -63,7 +63,7 @@ features_types_per_config = {
|
|
| 63 |
"ethnicity": datasets.Value("string"),
|
| 64 |
"parental_level_of_education": datasets.Value("int8"),
|
| 65 |
"has_standard_lunch": datasets.Value("int8"),
|
| 66 |
-
"has_completed_preparation_test": datasets.Value("
|
| 67 |
"reading_score": datasets.Value("int64"),
|
| 68 |
"writing_score": datasets.Value("int64"),
|
| 69 |
"has_passed_math_exam": datasets.ClassLabel(num_classes=2, names=("no", "yes"))
|
|
@@ -73,7 +73,7 @@ features_types_per_config = {
|
|
| 73 |
"ethnicity": datasets.Value("string"),
|
| 74 |
"parental_level_of_education": datasets.Value("int8"),
|
| 75 |
"has_standard_lunch": datasets.Value("int8"),
|
| 76 |
-
"has_completed_preparation_test": datasets.Value("
|
| 77 |
"reading_score": datasets.Value("int64"),
|
| 78 |
"math_score": datasets.Value("int64"),
|
| 79 |
"has_passed_writing_exam": datasets.ClassLabel(num_classes=2, names=("no", "yes")),
|
|
@@ -83,7 +83,7 @@ features_types_per_config = {
|
|
| 83 |
"ethnicity": datasets.Value("string"),
|
| 84 |
"parental_level_of_education": datasets.Value("int8"),
|
| 85 |
"has_standard_lunch": datasets.Value("int8"),
|
| 86 |
-
"has_completed_preparation_test": datasets.Value("
|
| 87 |
"writing_score": datasets.Value("int64"),
|
| 88 |
"math_score": datasets.Value("int64"),
|
| 89 |
"has_passed_reading_exam": datasets.ClassLabel(num_classes=2, names=("no", "yes")),
|
|
@@ -143,7 +143,7 @@ class StudentPerformance(datasets.GeneratorBasedBuilder):
|
|
| 143 |
|
| 144 |
yield row_id, data_row
|
| 145 |
|
| 146 |
-
def preprocess(self, data: pandas.DataFrame, config: str = "
|
| 147 |
data.columns = _BASE_FEATURE_NAMES
|
| 148 |
for feature in _ENCODING_DICS:
|
| 149 |
encoding_function = partial(self.encode, feature)
|
|
|
|
| 63 |
"ethnicity": datasets.Value("string"),
|
| 64 |
"parental_level_of_education": datasets.Value("int8"),
|
| 65 |
"has_standard_lunch": datasets.Value("int8"),
|
| 66 |
+
"has_completed_preparation_test": datasets.Value("int8"),
|
| 67 |
"reading_score": datasets.Value("int64"),
|
| 68 |
"writing_score": datasets.Value("int64"),
|
| 69 |
"has_passed_math_exam": datasets.ClassLabel(num_classes=2, names=("no", "yes"))
|
|
|
|
| 73 |
"ethnicity": datasets.Value("string"),
|
| 74 |
"parental_level_of_education": datasets.Value("int8"),
|
| 75 |
"has_standard_lunch": datasets.Value("int8"),
|
| 76 |
+
"has_completed_preparation_test": datasets.Value("int8"),
|
| 77 |
"reading_score": datasets.Value("int64"),
|
| 78 |
"math_score": datasets.Value("int64"),
|
| 79 |
"has_passed_writing_exam": datasets.ClassLabel(num_classes=2, names=("no", "yes")),
|
|
|
|
| 83 |
"ethnicity": datasets.Value("string"),
|
| 84 |
"parental_level_of_education": datasets.Value("int8"),
|
| 85 |
"has_standard_lunch": datasets.Value("int8"),
|
| 86 |
+
"has_completed_preparation_test": datasets.Value("int8"),
|
| 87 |
"writing_score": datasets.Value("int64"),
|
| 88 |
"math_score": datasets.Value("int64"),
|
| 89 |
"has_passed_reading_exam": datasets.ClassLabel(num_classes=2, names=("no", "yes")),
|
|
|
|
| 143 |
|
| 144 |
yield row_id, data_row
|
| 145 |
|
| 146 |
+
def preprocess(self, data: pandas.DataFrame, config: str = "math") -> pandas.DataFrame:
|
| 147 |
data.columns = _BASE_FEATURE_NAMES
|
| 148 |
for feature in _ENCODING_DICS:
|
| 149 |
encoding_function = partial(self.encode, feature)
|