-
Notifications
You must be signed in to change notification settings - Fork 13
/
dataset_descriptions.qmd
223 lines (160 loc) · 8.8 KB
/
dataset_descriptions.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# Dataset Descriptions {#sec-data-descript}
All data can be found in the [book's repo](https://github.com/m-clark/book-of-models/tree/main/data). Depending on when you access it, there may be more or less data available. We'll try to clean it up to make it more clear eventually, but it's easiest to use the code in the demonstrations to download the data directly.
## Movie reviews {#sec-dd-movie-reviews}
The movie reviews dataset was a fun way to use an LLM to create movie titles and reviews in a specific way, as well as other features. With features in hand, we then generated a rating outcome with specific feature-target relationships. It has 1000 rows and the following columns:
- `title`: The title of the movie
- `review_year`: The year the review was written
- `age`: The age of the reviewer
- `children_in_home`: The number of children in the reviewer's home
- `education`: The education level of the reviewer (Post-Graduate, Completed College, Completed High School)
- `gender`: The gender of the reviewer (male or female)
- `work_status`: The work status of the reviewer (Employed, Retired, Unemployed, Student)
- `genre`: The genre of the movie
- `release_year`: The year the movie was released
- `length_minutes`: The length of the movie in minutes
- `season`: The season the movie was released (e.g., Fall, Winter)
- `total_reviews`: The total number of reviews for the movie
- `rating`: The rating of the movie
- `review_text`: The text of the review
- `word_count`: The number of words in the review
- `review_year_0`: The review year starting from 0
- `release_year_0`: The release year starting from 0
- `*_sc`: Scaled (standardized) versions of age, length_minutes, total_reviews, and word_count
- `rating_good`: A binary version of rating, where 1 is a good rating (>= 3) and 0 is a bad rating (< 3)
Short link:
- [https://tinyurl.com/moviereviewsdata](https://tinyurl.com/moviereviewsdata)
Repo File:
- `data/movie_reviews.csv`
\footnotesize
```{r}
#| echo: false
#| label: tbl-movie-reviews-description
#| tbl-cap: Movie Reviews Dataset
df_reviews = read_csv('https://tinyurl.com/moviereviewsdata')
# works
# htmltools::tagList(map(summarize_data(df_reviews |> select(-matches('_sc$|year_0$'))), \(x) gt(x)))
# doesn't
# map(summarize_data(df_reviews |> select(-matches('_sc$|year_0$'))), \(x) print(gt(x)))
reviews_summ = summarize_data(df_reviews |> select(-matches('_sc$|year_0$')))
reviews_summ$character |>
select(-n_missing, -complete_rate) |>
gt(title = 'Movie Reviews Dataset (string)') |>
fmt_number(sep_mark = "", decimals=1)
reviews_summ$numeric |>
select(-n_missing, -complete_rate) |>
gt(title = 'Movie Reviews Dataset (numeric)') |>
fmt_number(sep_mark = "", decimals=1)
```
\normalsize
## World Happiness Report {#sec-dd-world-happiness-report}
The [World Happiness Report](https://worldhappiness.report/) is a survey of the state of global happiness that ranks countries by how 'happy' their citizens perceive themselves to be. You can also find additional details in their [supplemental documentation](https://happiness-report.s3.amazonaws.com/2024/Ch2+Appendix.pdf). Our 2018 data is from what was originally reported at that time (figure 2.2 in the corresponding report), and it also contains a life ladder score from the most recent survey, which is similar and very highly correlated.
The datasets contains the following columns:
- `country`: The country name
- `year`: The year of the survey
- `life_ladder`: The happiness score
- `log_gdp_per_capita`: The log of GDP per capita
- `social_support`: The social support score
- `healthy_life_expectancy_at_birth`: The healthy life expectancy at birth
- `freedom_to_make_life_choices`: The freedom to make life choices score
- `generosity`: The generosity score
- `perceptions_of_corruption`: The perceptions of corruption score
- `positive_affect`: The positive affect score
- `negative_affect`: The negative affect score
- `confidence_in_national_government`: The confidence in national government score
- `happiness_score`: The happiness score
- `dystopia_residual`: The dystopia residual score (difference from a 'least happy' country)
In addition there are standardized/scaled versions of the features, which are suffixed with `_sc`.
Short links:
- all years: [https://tinyurl.com/worldhappinessallyears](https://tinyurl.com/worldhappinessallyears)
- 2018: [https://tinyurl.com/worldhappiness2018](https://tinyurl.com/worldhappiness2018)
Repo Files:
- `data/world_happiness_all_years.csv`
- `data/world_happiness_2018.csv`
\scriptsize
```{r}
#| echo: false
#| label: tbl-happiness-description
#| tbl-cap: World Happiness Report Dataset (All Years)
df_happiness = read_csv('https://tinyurl.com/worldhappinessallyears')
happiness_summ = summarize_data(df_happiness |> select(-matches('country|cntry|_sc$')))
happiness_summ$numeric |>
select(-complete_rate) |>
gt(, title = 'World Happiness Dataset') |>
fmt_number(sep_mark = "", decimals=1)
```
```{r}
#| echo: false
#| label: tbl-happiness-2018-description
#| tbl-cap: World Happiness Report Dataset (2018)
df_happiness_2018 = read_csv('https://tinyurl.com/worldhappiness2018')
happiness_summ = summarize_data(df_happiness_2018 |> select(-matches('country|cntry|_sc$|year')))
happiness_summ$numeric |>
select(-n_missing, -complete_rate) |>
gt(title = 'World Happiness 2018 Dataset', decimals = 1)
```
\normalsize
## Heart Disease UCI {#sec-dd-heart-disease-uci}
This classic dataset comes from the [UCI ML repository](https://archive.ics.uci.edu/dataset/45/heart+disease). We took a version from Kaggle, and features and target were renamed to be more intelligible. Here is a brief description from UCI:
>This database contains 76 attributes, but all published experiments refer to using a subset of 14 of them. In particular, the Cleveland database is the only one that has been used by ML researchers to date. The "goal" field refers to the presence of heart disease in the patient. It is integer valued from 0 (no presence) to 4. Experiments with the Cleveland database have concentrated on simply attempting to distinguish presence (values 1,2,3,4) from absence (value 0).
- `age`: Age in years
- `male`: 'yes' or 'no'
- `chest_pain_type`: 'typical', 'atypical', 'non-anginal', 'asymptomatic'
- `resting_bp`: Resting blood pressure (mm Hg)
- `cholesterol`: Serum cholesterol (mg/dl)
- `fasting_blood_sugar`: '> 120 mg/dl' or '<= 120 mg/dl'
- `resting_ecg`: 'normal', 'left ventricular hypertrophy', 'ST-T wave abnormality'
- `max_heart_rate`: Maximum heart rate achieved
- `exercise_induced_angina`: 'yes' or 'no'
- `st_depression`: ST depression induced by exercise relative to rest
- `slope`: 'upsloping', 'flat', 'downsloping'
- `num_major_vessels`: Number of major vessels (0-3) colored by fluoroscopy
- `thalassemia`: 'normal', 'fixed defect', 'reversible defect'
- `heart_disease`: 'yes' or 'no'
Short links:
- processed: [https://tinyurl.com/heartdiseaseprocessed](https://tinyurl.com/heartdiseaseprocessed)
- numeric features only: [https://tinyurl.com/heartdiseaseprocessednumeric](https://tinyurl.com/heartdiseaseprocessednumeric)
Repo Files:
- `data/heart_disease_processed.csv`
- `data/heart_disease_processed_numeric_sc.csv`
\footnotesize
```{r}
#| echo: false
#| label: tbl-heart-disease-description
#| tbl-cap: Heart Disease UCI Dataset
df_heart = read_csv('https://tinyurl.com/heartdiseaseprocessed')
heart_summ = summarize_data(df_heart)
heart_summ$character |>
select(-n_missing, -complete_rate) |>
gt(title = 'Heart Disease (string)', decimals = 1)
heart_summ$numeric |>
select(-n_missing, -complete_rate) |>
gt(title = 'Heart Disease (numeric)', decimals = 1)
```
\normalsize
## Fish {#sec-dd-fish}
This is a very simple data set with a count target variable. It's also good if you want to try your hand at zero-inflated models. The background is that state wildlife biologists want to model how many fish are being caught by fishermen at a state park.
- `nofish`: We've never seen this explained. Originally 0 and 1, 0 is equivalent to livebait == 'yes', so it may be whether the primary motivation of the camping trip is for fishing or not.
- `livebait`: Whether live bait was used or not
- `camper`: Whether or not they brought a camper
- `persons`: How many total persons on the trip
- `child`: How many children present
- `count`: Number of fish caught
Short Link:
- [https://tinyurl.com/fishcountdata](https://tinyurl.com/fishcountdata)
Repo File:
- `data/fish.csv`
\footnotesize
```{r}
#| echo: false
#| label: tbl-fish-description
#| tbl-cap: Fish Dataset
df_fish = read_csv('https://tinyurl.com/fishcountdata')
fish_summ = summarize_data(df_fish)
fish_summ$character |>
select(-n_missing, -complete_rate) |>
gt(title = 'Fish (string)', decimals = 1)
fish_summ$numeric |>
select(-n_missing, -complete_rate) |>
gt(title = 'Fish (numeric)', decimals = 1)
```
\normalsize