initialize.py: sets up the table and customer set
main.py: calculates scores and discounts
Sample of the user tables
I felt like challenging myself with a solo-hack, and felt that dealing with a more analytical problem would be something very much out of my normal comfort zone! After a long brain storming session, I laid out a rough plan and decided to embark on a trek to learn the basics of Python and ML. The goal? Learn something I've always been meaning to, and build something impressive!
As for the project: Companies often aim to price discriminate in order to capture customers at the perfect price point they're willing to pay for- allowing them to maximize their revenues! In order to do this, companies often send out coupons via mail or through advertising online. Often however, there are inefficiencies- for instance, I rarely use McDonald's coupons for the sake of going, but whenever it coincides with a purchase made on a whim. So, given the great amount of demographic information available on TD's Da Vinci set, combined with all their transaction data, why not try to maximize efficiencies by tailoring custom coupons/discounts? By developing a ML model through TensorFlow and a sprinkle of math, I've done just that!
How It Works
- It first scrapes TD's site for user data, filtering by your preferred customer demographics
- Each customer is given a priority rating based off their spending in the industry and their preference for competitors
- Using a Linear Regression Model, determine an optimal discount rate, optimizing weights on demographic details
- Changes in score are used as positive/negative reinforcement to further train the optimal discount rate and determine which factors are most important
- Rinse and repeat- distribute coupons with address data, recalculate the affect on transactions, optimize, get money
Challenges I ran Into
Learning Python and the basics of ML while finding a way to apply them to a very unfamiliar data problem was challenging! I spent a lot of time looking up tutorials, brainstorming which features were feasible, and researching ML models based off what I wanted to do, and what I could realistically do. All in all, the biggest hiccups while coding were small syntactic issues with JSON/SQLite/requests/Python- each has format preferences and figuring out issues related to them was painful.
Clean up, but mostly further refining/training the model and getting the data to do so If I had more time for the project, the next step would be to programmatically generate the actual PDF files for coupons, and maybe even use user data to find and advertise to individuals on Facebook.