H. Sherry Zhang
Department of Statistics and Data Sciences
University of Texas at Austin
library(usethis) create_from_github("SDS322E-26FALL/1101-ml1", fork = FALSE)
So far, we’ve learned two types of machine learning tasks:
Today we start from real data and ask: what question could machine learning answer here?
No modeling today: you will use data wrangling and visualization to explore the data, shape the question, and check that it is doable.
In parts II and III, we will build models for one of these datasets.
For the dataset you pick, think about:
TidyTuesday 2020-02-11: bookings at two hotels in Portugal, a city hotel and a resort hotel, with arrival dates from 2015 to 2017.
# A tibble: 119,390 × 6
hotel is_canceled lead_time deposit_type market_segment reservation_status
<chr> <dbl> <dbl> <chr> <chr> <chr>
1 Resort Hotel 0 342 No Deposit Direct Check-Out
2 Resort Hotel 0 737 No Deposit Direct Check-Out
3 Resort Hotel 0 7 No Deposit Direct Check-Out
4 Resort Hotel 0 13 No Deposit Corporate Check-Out
5 Resort Hotel 0 14 No Deposit Online TA Check-Out
# ℹ 119,385 more rows
TidyTuesday 2020-07-07: coffee lots graded by trained tasters for the Coffee Quality Institute, with where and how each coffee was grown.
[1] 1339 43
coffee |>
select(total_cup_points, species, country_of_origin, altitude_mean_meters,
processing_method, aroma, flavor, acidity)# A tibble: 1,339 × 8
total_cup_points species country_of_origin altitude_mean_meters processing_method aroma flavor
<dbl> <chr> <chr> <dbl> <chr> <dbl> <dbl>
1 90.6 Arabica Ethiopia 2075 Washed / Wet 8.67 8.83
2 89.9 Arabica Ethiopia 2075 Washed / Wet 8.75 8.67
3 89.8 Arabica Guatemala 1700 <NA> 8.42 8.5
4 89 Arabica Ethiopia 2000 Natural / Dry 8.17 8.58
5 88.8 Arabica Ethiopia 2075 Washed / Wet 8.25 8.5
# ℹ 1,334 more rows
# ℹ 1 more variable: acidity <dbl>
TidyTuesday 2020-01-21: songs from Spotify playlists in six genres, with Spotify’s audio features for each song.
[1] 32833 23
spotify |>
select(track_name, playlist_genre, track_popularity, danceability, energy,
tempo, duration_ms)# A tibble: 32,833 × 7
track_name playlist_genre track_popularity danceability energy tempo duration_ms
<chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
1 I Don't Care (with Justin B… pop 66 0.748 0.916 122. 194754
2 Memories - Dillon Francis R… pop 67 0.726 0.815 100.0 162600
3 All the Time - Don Diablo R… pop 70 0.675 0.931 124. 176616
4 Call You Mine - Keanu Silva… pop 60 0.718 0.93 122. 169093
5 Someone You Loved - Future … pop 69 0.65 0.833 124. 189052
# ℹ 32,828 more rows
TidyTuesday 2025-01-21: expeditions to peaks in the Nepal Himalaya from 2020 to 2024, from the Himalayan Database. Information about each peak is in a second table.
tuesdata <- tidytuesdayR::tt_load("2025-01-21")
exped <- tuesdata$exped_tidy
peaks <- tuesdata$peaks_tidy
dim(exped)[1] 882 69
[1] 480 29
exped |>
left_join(peaks |> select(PEAKID, PKNAME, HEIGHTM), by = "PEAKID") |>
select(PKNAME, HEIGHTM, YEAR, SEASON_FACTOR, TOTMEMBERS, TOTHIRED, O2USED,
SUCCESS1)# A tibble: 882 × 8
PKNAME HEIGHTM YEAR SEASON_FACTOR TOTMEMBERS TOTHIRED O2USED SUCCESS1
<chr> <dbl> <dbl> <chr> <dbl> <dbl> <lgl> <lgl>
1 Everest 8849 2020 Spring 0 6 TRUE TRUE
2 Everest 8849 2020 Spring 12 0 TRUE TRUE
3 Everest 8849 2020 Spring 20 22 TRUE TRUE
4 Ama Dablam 6814 2020 Autumn 14 19 FALSE TRUE
5 Ama Dablam 6814 2020 Autumn 6 8 FALSE TRUE
# ℹ 877 more rows
In your group, pick one of the four datasets. Load it, read its data dictionary, and work through the checklist: