Hi, I'm Jordan 👋

I'm a data scientist and creative.

Jordan Uyeki

Hi, I'm Jordan 👋

I'm a data scientist and creative.

Animal Shelter Outcome Predictions

Animal Shelter Outcome Predictions

Table of Contents

Project Overview
The Data
Data Preparation and Feature Engineering
Modeling
Results
Future Directions

For a video walkthrough of my project, please see this youtube video.

Project Overview

According to the ASPCA, pet adoption rates skyrocketed across the United States during the COVID-19 pandemic, with nearly 1 in 5 American households adopting a new furry friend into their family. My family was among those who adopted a new pet during the pandemic - in August 2020, we adopted my bestie, Bolt!

Bolt

We got Bolt at 3 months old from a US-based organization that rescues dogs from Mexico. With so many other families looking for puppies, I spent hours scouring listings on a popular platform, Petfinder and quickly noticed the vast differences in quality of listings on the site. I felt that for a lot of these animals, simply having a better quality profile could improve their chances of adoption.

The goal for this project was to build a machine learning model that can predict adoption outcomes for shelter/rescue animals based on their adoption profiles. Ultimately this model could be used by rescues and shelters to optimize animal profiles, giving them the best chance of finding their fur-ever families, just like Bolt.

The Data

The data used for this project was collected by the Austin Animal Center and is publically available on kaggle.

The dataset contains information for over 50,000 shelter animals (predominantly dogs and cats) with 13 variables:

Data Preparation / Feature Engineering

Prior to modeling, the data needed to be cleaned and prepared. The major steps are outlined below but for more details, please see the notebook in my project repository on GitHub.

To start, I separated out the outcome variable of interest from the rest of the variables so that they could be prepared separately. To prepare the outcome variable, I used an encoder from sklearn’s preprocessing module to convert the categorical shelter animal outcome variable into numerical labels

Prior to modeling, the predictor variables needed to be transformed to make more usable by the models downstream. I used sklearn’s pipeline module, which allows you to make individual pipelines for each variable which can then be combined into one seamless preprocessing pipeline. Data imputation and transformations were applied to the variables of interest.

Modeling

Before modeling, I split the data into an 80/20 split - a random 80% of the data was used for training the models while the other 20% was witheld to evaluate and compare the models. For this project, I evaluated and compared 3 different candidate classifier models:

I utilized a Randomized Cross Validation method from sklearn’s model selection module to fit and compare the candidate models. One advantage of this method over a regular grid search is that the hyperparameter search is optimized - only a sample, rather than all, of the hyperparameter combinations are compared. With multiple candidate models and hyperparameters to tune, the number of models to run can quickly scale - this method saves a lot of computing power.

Results

After a 5-fold cross validation, the best performing model was a Random Forest Classifier with the following hyperparameters:

To evaluate the models, I considered 2 different evaluation metrics, accuracy and the F1 score. Accuracy, which is a little easier to understand as it is simply the percentage of classificatons that are correct. The random forest model attained a 77.5% accuracy on the witheld test dataset. The F1 score gives us more insight into how the model is specifically performing on the different outcome types; specifically, it is the precision to recall ratio. The model got a F1 score of 0.237, indicating that the precision and recall of the model is not good.

Future Directions

In future iterations of this project, I would like to:

With further improvements, this model could be very useful in the animal welfare sectors. Thousands of dogs and cats are registered in rescue/shelter/pound systems each year. Many of these animals are fortunate enough to find forever homes but others are not so lucky. According the the ASPCA, over 1.5 million shelter animals are euthanized each year due to overcapacity. To help lower this number, this model could be used as a way to evaluate shelter animal adoption profiles to optimize their chance of finding a family of their own.

This analysis was completed for the final project for MSDS699: Machine Learning Lab (a graduate class part of the Masters in Data Science curriculum at the University of San Francisco).