How I Taught a Small Language Model to Reason

For the last few years, this blog has mostly been about tidy data, statistical models, and the occasional TidyTuesday chart. This post is different. Over the past few months I did something I had wanted to try for a long time: I built a small AI language model from scratch — the same basic kind of technology behind chatbots — and then tried to teach it to reason: to work through a problem step by step before answering, the way you might show your work on a math test.

Read more

Using LASSO Bootstraps to Predict Animal Crossing Rating

In this blog post, I will use the tidymodels meta-package to predict the animal crossing rating. Previously, I had a blog post visualizing the same data set, and you can view it here. Since the data set contains user comments along with the game rating, and LASSO is a good model for using words as predictors, this blog post I will use bootstrap resampling method to illustrate how to tune the LASSO model and # of words as predictors in the feature engineering steps.

Read more

LASSO Model on Predicting GDPR Fines

In this blog post, I will use LASSO model to predict the GDPR fines. Before this post, I have another post on visualizing the same data set. You can view it here. Also, the textrecipes package is used in the modeling process, as the data set privodes some text columns, which can be transformed as predictors.

Read more

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