PCA on Cocktail Ingredients (with recipes package used)

In this blog post, I will use step_pca() provided by the recipe package to apply PCA analysis to a cocktail dataset. A similar blog post of mine, which you can view here, provides PCA analysis on the same dataset. The difference is that post uses svd() approach to carry out the analysis, but this post uses the tidymodels approach. Read more

Using LASSO to Predict Monthly Brew Materials

In this blog post, I will use a data set about beer brewing materials provided by TidyTuesday to make prediction for the monthly barrels of several beer materials. The tidymodels meta-package will be used, with bootstrap as the resampling technique. library(tidyverse) library(tidymodels) library(lubridate) theme_set(theme_bw()) brewing_materials_raw <- read_csv("https://raw. Read more

Random Forest on Classifying San Francisco Trees

In this blog post, I will use random forest to classify a multi-classification problem on SF Trees provided by TidyTuesday. As always, tidyverse and tidymodels meta-packages will be used to process data and build machine learning model respectively. library(tidyverse) library(tidymodels) theme_set(theme_bw()) sf_trees <- read_csv('https://raw. Read more

Using LASSO to Predict Office IMDB Rating

In this blog post, I will use LASSO model to predict IMDB rating of the Office show. The data set is provided by the schrute package. Some ideas in this blog post are inspired by Julia Silge’s post (link). library(tidyverse) library(tidymodels) library(textrecipes) library(lubridate) library(vip) theme_set(theme_bw()) office <- schrute::theoffice %>% mutate(air_date = ymd(air_date)) %>% select(-c(director, writer, text_w_direction)) IMDB rating per episode: Read more

Random Forest, LASSO, and XGboost on Classifying School Total Minority

This blog post will use three models, i.e., Random Forest, LASSO, and XGboost on data sets provided by TidyTuesday about college costs and minority information. Some ideas in this blog post are inspired by Julia Silge’s blog post (link). library(tidyverse) library(tidymodels) library(geofacet) library(scales) theme_set(theme_bw()) tuition_cost <- readr::read_csv("https://raw. Read more

Random Forest and XGboost on Predicting Continent

In this blog post, I will use a food consumption data set provided by TidyTuesday joined by a continent data set provided by the worlddatajoin package. You can download the package by typing devtools::install_github("PursuitOfDataScience/worlddatajoin") on the RStudio console. This is one of the blog posts I use the tidymodels meta-package to practice machine learning, and some of the ideas presented in this post are inspired by Julia Silge’s blog post (link). Read more

K-Nearest Neighbors & Decision Tree on Hotel Bookings

In this blog post, I will analyze a hotel booking dataset from TidyTuesday, and some of the ideas presented are inspired by Julia Silge’s blog post (link) for learning purposes solely. library(tidyverse) library(tidymodels) library(lubridate) library(themis) theme_set(theme_bw()) hotels <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-02-11/hotels.csv") %>% inner_join(tibble(month = month.name, month_abb = month. Read more

Comparing Linear Regression & Random Forest on NFL Data

In this blog post, I will use tidyverse and tidymodels to analyze some NFL data sets from TidyTuesday. I will use a simple linear regression and a slightly more complicated random forest model to make predictions, and through the predictive performance in both training and testing data, we can see that the linear regression model has high bias and the random forest model has the high variance. Read more

Salary Survey Data Visualization

This blog post analyzes salary survey from a wide range of perspectives, including race, gender, etc. As usual, the data comes from TidyTuesday. library(tidyverse) library(lubridate) library(scales) library(broom) library(geofacet) theme_set(theme_bw()) survey <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-05-18/survey.csv') %>% filter(!is.na(state), !is.na(highest_level_of_education_completed), !is.na(race), currency == "USD", annual_salary > 2000, fct_lump(state, n = 51) ! Read more

Broadband Data Visualization with zipcodeR and tigris Used

This blog post will analyze the broadband availability and usage situation across the U.S. per county. This is my first time using zipcodeR and tigris in a blog post, and this is also my first time making a U.S. map on county-level. Thanks TidyTuesday for providing the datasets. Read more