Recommendation system implementation for Dummies

Bhavesh Bhatt
Aug 27, 2017 · 3 min read
  • Imagine that you have recently gone bankrupt and 1 fine day you get a call from a bank agent requesting you to subscribe for a term deposit.

This is the reaction most of us will have.

  • Banks too invest a lot, they invest in the agents that call you up and also the telephone bills are huge.

What if I tell you, both the end user and the bank can be profited by using a simple recommendation system.

I’ll describe the approach below.

For the demo purpose, I have used the bank dataset from the below link -

https://archive.ics.uci.edu/ml/datasets/bank+marketing

The bank already has data of 42000+ customers with the following details
- age, job, marital status, education, loan defaulter, balance, housing loan, personal loan.
- last contacted, day, month, duration, previous outcome
- Finally variable y whether you did subscribe for the term plan or not.

After doing a bit of preprocessing to the data

  • Converting Yes and No to 0 and 1.
  • Converting Categorical variables to Numeric variables using One Hot encoding.
  • Dropping columns such as contact, day and month which typically don’t contribute much to the prediction of the target variable.

This is something that I get after doing a bit of preprocessing.

I split my data into train and test and predict the outcome based on logistic regression model.

I get an accuracy score of around 90%

My goal isn’t however solved. What is the use of a tool if I cannot use it in my data to data life.

Suppose a new customer comes in with the following details

I just call my recommendation engine and check the output and what do I observe?

Any guesses? Will I be telling my customer agent to call this guy up for a term deposit subscription?

The recommendation engine gives me the following output

It gives me an output 0 with a probability of 0.96!

So, I can clearly say that this person won’t be interested for a term deposit subscription based on the data he has provided.

I know it was this simple

)

Bhavesh Bhatt

Written by

Google Developer Expert for Machine Learning https://www.youtube.com/BhaveshBhatt8791/

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade