Datasets:
Upload 2 files
Browse files- README.md +73 -1
- speeddating.py +10 -25
README.md
CHANGED
|
@@ -14,4 +14,76 @@ configs:
|
|
| 14 |
- dating
|
| 15 |
---
|
| 16 |
# Speed dating
|
| 17 |
-
The [Speed dating dataset](https://www.openml.org/search?type=data&sort=nr_of_likes&status=active&id=40536)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
- dating
|
| 15 |
---
|
| 16 |
# Speed dating
|
| 17 |
+
The [Speed dating dataset](https://www.openml.org/search?type=data&sort=nr_of_likes&status=active&id=40536) from OpenML.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
# Configurations and tasks
|
| 21 |
+
- `dating` Predict the success of speed dating.
|
| 22 |
+
|
| 23 |
+
# Features
|
| 24 |
+
|**Features** |**Type** |
|
| 25 |
+
|---------------------------------------------------|---------|
|
| 26 |
+
|`is_dater_male` |`int8` |
|
| 27 |
+
|`dater_age` |`int8` |
|
| 28 |
+
|`dated_age` |`int8` |
|
| 29 |
+
|`age_difference` |`int8` |
|
| 30 |
+
|`dater_race` |`string` |
|
| 31 |
+
|`dated_race` |`string` |
|
| 32 |
+
|`are_same_race` |`int8` |
|
| 33 |
+
|`same_race_importance_for_dater` |`float64`|
|
| 34 |
+
|`same_religion_importance_for_dater` |`float64`|
|
| 35 |
+
|`attractiveness_importance_for_dated` |`float64`|
|
| 36 |
+
|`sincerity_importance_for_dated` |`float64`|
|
| 37 |
+
|`intelligence_importance_for_dated` |`float64`|
|
| 38 |
+
|`humor_importance_for_dated` |`float64`|
|
| 39 |
+
|`ambition_importance_for_dated` |`float64`|
|
| 40 |
+
|`shared_interests_importance_for_dated` |`float64`|
|
| 41 |
+
|`attractiveness_score_of_dater_from_dated` |`float64`|
|
| 42 |
+
|`sincerity_score_of_dater_from_dated` |`float64`|
|
| 43 |
+
|`intelligence_score_of_dater_from_dated` |`float64`|
|
| 44 |
+
|`humor_score_of_dater_from_dated` |`float64`|
|
| 45 |
+
|`ambition_score_of_dater_from_dated` |`float64`|
|
| 46 |
+
|`shared_interests_score_of_dater_from_dated` |`float64`|
|
| 47 |
+
|`attractiveness_importance_for_dater` |`float64`|
|
| 48 |
+
|`sincerity_importance_for_dater` |`float64`|
|
| 49 |
+
|`intelligence_importance_for_dater` |`float64`|
|
| 50 |
+
|`humor_importance_for_dater` |`float64`|
|
| 51 |
+
|`ambition_importance_for_dater` |`float64`|
|
| 52 |
+
|`shared_interests_importance_for_dater` |`float64`|
|
| 53 |
+
|`self_reported_attractiveness_of_dater` |`float64`|
|
| 54 |
+
|`self_reported_sincerity_of_dater` |`float64`|
|
| 55 |
+
|`self_reported_intelligence_of_dater` |`float64`|
|
| 56 |
+
|`self_reported_humor_of_dater` |`float64`|
|
| 57 |
+
|`self_reported_ambition_of_dater` |`float64`|
|
| 58 |
+
|`reported_attractiveness_of_dated_from_dater` |`float64`|
|
| 59 |
+
|`reported_sincerity_of_dated_from_dater` |`float64`|
|
| 60 |
+
|`reported_intelligence_of_dated_from_dater` |`float64`|
|
| 61 |
+
|`reported_humor_of_dated_from_dater` |`float64`|
|
| 62 |
+
|`reported_ambition_of_dated_from_dater` |`float64`|
|
| 63 |
+
|`reported_shared_interests_of_dated_from_dater` |`float64`|
|
| 64 |
+
|`dater_interest_in_sports` |`float64`|
|
| 65 |
+
|`dater_interest_in_tvsports` |`float64`|
|
| 66 |
+
|`dater_interest_in_exercise` |`float64`|
|
| 67 |
+
|`dater_interest_in_dining` |`float64`|
|
| 68 |
+
|`dater_interest_in_museums` |`float64`|
|
| 69 |
+
|`dater_interest_in_art` |`float64`|
|
| 70 |
+
|`dater_interest_in_hiking` |`float64`|
|
| 71 |
+
|`dater_interest_in_gaming` |`float64`|
|
| 72 |
+
|`dater_interest_in_clubbing` |`float64`|
|
| 73 |
+
|`dater_interest_in_reading` |`float64`|
|
| 74 |
+
|`dater_interest_in_tv` |`float64`|
|
| 75 |
+
|`dater_interest_in_theater` |`float64`|
|
| 76 |
+
|`dater_interest_in_movies` |`float64`|
|
| 77 |
+
|`dater_interest_in_concerts` |`float64`|
|
| 78 |
+
|`dater_interest_in_music` |`float64`|
|
| 79 |
+
|`dater_interest_in_shopping` |`float64`|
|
| 80 |
+
|`dater_interest_in_yoga` |`float64`|
|
| 81 |
+
|`interests_correlation` |`float64`|
|
| 82 |
+
|`expected_satisfaction_of_dater` |`float64`|
|
| 83 |
+
|`expected_number_of_likes_of_dater_from_20_people` |`int8` |
|
| 84 |
+
|`expected_number_of_dates_for_dater` |`int8` |
|
| 85 |
+
|`dater_liked_dated` |`float64`|
|
| 86 |
+
|`probability_dated_wants_to_date` |`float64`|
|
| 87 |
+
|`already_met_before` |`int8` |
|
| 88 |
+
|`dater_wants_to_date` |`int8` |
|
| 89 |
+
|`dated_wants_to_date` |`int8` |
|
speeddating.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
"""Speeddating Dataset"""
|
| 2 |
|
| 3 |
from typing import List
|
| 4 |
-
from functools import partial
|
| 5 |
|
| 6 |
import datasets
|
| 7 |
|
|
@@ -77,12 +76,6 @@ _BASE_FEATURE_NAMES = [
|
|
| 77 |
"is_match"
|
| 78 |
]
|
| 79 |
|
| 80 |
-
_ENCODING_DICS = {
|
| 81 |
-
"sex": {
|
| 82 |
-
"female": 0,
|
| 83 |
-
"male": 1
|
| 84 |
-
}
|
| 85 |
-
}
|
| 86 |
|
| 87 |
DESCRIPTION = "Speed-dating dataset."
|
| 88 |
_HOMEPAGE = "https://www.openml.org/search?type=data&sort=nr_of_likes&status=active&id=40536"
|
|
@@ -95,7 +88,7 @@ urls_per_split = {
|
|
| 95 |
}
|
| 96 |
features_types_per_config = {
|
| 97 |
"dating": {
|
| 98 |
-
"
|
| 99 |
"dater_age": datasets.Value("int8"),
|
| 100 |
"dated_age": datasets.Value("int8"),
|
| 101 |
"age_difference": datasets.Value("int8"),
|
|
@@ -198,13 +191,16 @@ class Speeddating(datasets.GeneratorBasedBuilder):
|
|
| 198 |
]
|
| 199 |
|
| 200 |
def _generate_examples(self, filepath: str):
|
| 201 |
-
|
| 202 |
-
|
|
|
|
| 203 |
|
| 204 |
-
|
| 205 |
-
|
| 206 |
|
| 207 |
-
|
|
|
|
|
|
|
| 208 |
|
| 209 |
def preprocess(self, data: pandas.DataFrame, config: str = "dating") -> pandas.DataFrame:
|
| 210 |
data.loc[data.race == "?", "race"] = "unknown"
|
|
@@ -220,8 +216,6 @@ class Speeddating(datasets.GeneratorBasedBuilder):
|
|
| 220 |
data.loc[data.race == "Black/African American", "race"] = "african-american"
|
| 221 |
data.loc[data.race_o == "Black/African American", "race_o"] = "african-american"
|
| 222 |
|
| 223 |
-
sex_transform = partial(self.encoding_dics, "sex")
|
| 224 |
-
data.loc[:, "gender"] = data.gender.apply(sex_transform)
|
| 225 |
data = data.rename(columns={"gender": "sex"})
|
| 226 |
|
| 227 |
data.drop("has_null", axis="columns", inplace=True)
|
|
@@ -322,13 +316,4 @@ class Speeddating(datasets.GeneratorBasedBuilder):
|
|
| 322 |
|
| 323 |
data.columns = _BASE_FEATURE_NAMES
|
| 324 |
|
| 325 |
-
|
| 326 |
-
return data
|
| 327 |
-
else:
|
| 328 |
-
raise ValueError(f"Unknown config: {config}")
|
| 329 |
-
|
| 330 |
-
def encoding_dics(self, feature, value):
|
| 331 |
-
if feature in _ENCODING_DICS:
|
| 332 |
-
return _ENCODING_DICS[feature][value]
|
| 333 |
-
raise ValueError(f"Unknown feature: {feature}")
|
| 334 |
-
|
|
|
|
| 1 |
"""Speeddating Dataset"""
|
| 2 |
|
| 3 |
from typing import List
|
|
|
|
| 4 |
|
| 5 |
import datasets
|
| 6 |
|
|
|
|
| 76 |
"is_match"
|
| 77 |
]
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
DESCRIPTION = "Speed-dating dataset."
|
| 81 |
_HOMEPAGE = "https://www.openml.org/search?type=data&sort=nr_of_likes&status=active&id=40536"
|
|
|
|
| 88 |
}
|
| 89 |
features_types_per_config = {
|
| 90 |
"dating": {
|
| 91 |
+
"is_dater_male": datasets.Value("int8"),
|
| 92 |
"dater_age": datasets.Value("int8"),
|
| 93 |
"dated_age": datasets.Value("int8"),
|
| 94 |
"age_difference": datasets.Value("int8"),
|
|
|
|
| 191 |
]
|
| 192 |
|
| 193 |
def _generate_examples(self, filepath: str):
|
| 194 |
+
if self.config.name == "dating":
|
| 195 |
+
data = pandas.read_csv(filepath)
|
| 196 |
+
data = self.preprocess(data, config=self.config.name)
|
| 197 |
|
| 198 |
+
for row_id, row in data.iterrows():
|
| 199 |
+
data_row = dict(row)
|
| 200 |
|
| 201 |
+
yield row_id, data_row
|
| 202 |
+
else:
|
| 203 |
+
raise ValueError(f"Unknown config: {self.config.name}")
|
| 204 |
|
| 205 |
def preprocess(self, data: pandas.DataFrame, config: str = "dating") -> pandas.DataFrame:
|
| 206 |
data.loc[data.race == "?", "race"] = "unknown"
|
|
|
|
| 216 |
data.loc[data.race == "Black/African American", "race"] = "african-american"
|
| 217 |
data.loc[data.race_o == "Black/African American", "race_o"] = "african-american"
|
| 218 |
|
|
|
|
|
|
|
| 219 |
data = data.rename(columns={"gender": "sex"})
|
| 220 |
|
| 221 |
data.drop("has_null", axis="columns", inplace=True)
|
|
|
|
| 316 |
|
| 317 |
data.columns = _BASE_FEATURE_NAMES
|
| 318 |
|
| 319 |
+
return data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|