October 7, 2025 | Case Study
Project Deep Dive: Building the Pet Recommender AI
Every data science portfolio needs a project that is both technically interesting and personally engaging. For me, that was the Pet Recommender AI. The idea was simple: could I use data to help people find their perfect animal companion, moving beyond simple quizzes to a more data-driven approach? This post details the journey from concept to a deployed web application.
Phase 1: The Data Foundation
The most critical part of any data project is the data itself. A comprehensive, clean dataset for matching pets to lifestyles doesn't really exist, so I had to create one. I researched about 20 popular pets, gathering information on traits like energy level, grooming needs, apartment friendliness, and cost. I compiled this into a structured pets.csv file, which became the knowledge base for the entire application. This step alone was a great exercise in data collection and structuring.
Phase 2: Choosing the "Brain"
With the data ready, I had to decide on the matching logic. While I could have used a machine learning model like K-Nearest Neighbors, I opted for a more transparent and interpretable method first: a custom scoring algorithm. This Python script takes a user's answers and iterates through each pet in the dataset, assigning a "compatibility score" based on a set of weighted rules. For example, a "high energy" user gets a big score boost for a "high energy" dog, while an apartment dweller gets a penalty for a pet that isn't apartment-friendly.
Phase 3: Building the Web Interface
A command-line script is functional, but not user-friendly. To bring the project to life, I built a web application using Flask, a lightweight Python framework. This involved creating two main components:
- An
index.htmlpage with a form to capture the user's answers. - An
app.pyscript to serve the webpage, receive the form data, run the scoring logic, and render aresults.htmlpage with the top 3 pet recommendations.
Phase 4: Deployment
Finally, to make the application accessible to everyone, I deployed it on Render. This involved creating a requirements.txt file to list the necessary Python packages, and a Procfile to tell Render's servers how to start the application using a production-ready server called Gunicorn. This final step was a fantastic learning experience in moving a project from a local machine to a live, public URL.
What I Learned
This project was a complete end-to-end data science exercise. It reinforced the importance of good data, demonstrated the power of a simple but effective algorithm, and provided hands-on experience with web development and cloud deployment. It's a testament to how a simple idea can evolve into a fully functional, shareable application.