
Predicting Opportunities to Cross Sell Insurance Using Heimdall
Insurance is crucial in today's uncertain world because it provides individuals, businesses, and societies with a safety net against unforeseen risks and financial hardships. Whether it's health, auto, home, or life insurance, these policies offer protection and peace of mind. In the face of unexpected events such as accidents, illnesses, natural disasters, or even untimely deaths, insurance helps mitigate the financial impact, ensuring that individuals and families can access necessary resources without depleting their savings or going into debt. Moreover, insurance plays a pivotal role in promoting economic stability by allowing businesses to operate confidently, knowing that they have a safeguard against potential losses. Overall, insurance is a fundamental tool for safeguarding our well-being, assets, and the broader economy in an increasingly uncertain world.
Insurance Business
An insurance policy serves as a contractual agreement between an individual or entity and an insurance company. This agreement is based on the principle that the policyholder pays a predetermined amount, known as the premium, to the insurance company at regular intervals, which could be monthly, quarterly, or annually. In exchange for these premium payments, the insurance company assumes the responsibility of providing financial protection in the event of specific adverse circumstances. By paying premiums, policyholders essentially pool their resources with others who share similar risks, creating a collective fund that the insurance company can tap into when policyholders face these adverse events. This shared risk distribution spreads the financial burden and ensures that those affected receive compensation to help them recover or mitigate the losses incurred. The terms and conditions of insurance policies are detailed and specific, outlining the scope of coverage, the types of losses or damages eligible for compensation, any deductible amounts, and the limits of liability. This precision ensures clarity and transparency in the insurance arrangement, allowing policyholders to understand precisely what they are paying for and what they can expect in return.
Cross-Selling Insurance Products
An insurance firm usually sells more than one type of insurance - health, auto, home, or life insurance and the insurances agents of the firm are often looking to cross sell products to their existing customers in order to increase their bottom line. In many countries, insurance is required for various activities like driving or home ownership, so people need more than one type of insurance.
The tough part is identifying the customers who are best fit to purchase more than one product. In this example, we are going to take a look at some historical data to predict if a customer who has health insurance would be interested in purchasing an auto insurance policy. In order to build this model we will take a look at hundred thousand customer records which have some demographic, vehicle, and policy information. Below is the table of features or columns in our dataset:

The variable we are interested in predicting is the Response. We want to know if the customer who already has health insurance will be interested in purchasing auto-insurance.
Model Building with Heimdall
Let's take our data set over to Heimdall's modeling engine to get started. Before we begin modeling, we will go ahead and remove the id column because that will not be necessary when we are doing modeling.
Once we upload our data, we select Response as the target variable. This is just indicating to Heimdall that we are interested in predicting the Response variable given the other columns. We can then choose Optimize to allow Heimdall to find the best model that fits the problem we are trying to solve. After a couple minutes, we get our high level summary:

This high level summary tells us that our model is 88% percent accurate and since this problem is deciding if a customer belongs to one class or the other (interested/not interested), we need to review two additional metrics - precision and recall. Precision helps us see how well the model avoids making false positives - in this case, how well the model avoids saying that a customer is interested when they aren't. Recall helps us understand how many of the positive instances are captured by the model. Precision is all about the quality of the prediction while Recall is about the quantity. We want a good balance between the two in order to understand true performance of the classification solution
Identify Cross Sell Opportunities
Now that we have a model built to help us identify the customers who are interested in auto insurance, we can use the REST API endpoint automatically deployed by Heimdall to run predictions on our customer data. Let's get our endpoint set up by enabling the endpoint under the model details page. While enabling the endpoint, we will receive a unique API key to use with our model. After we enable the endpoint, we should see the code editor with the sample code to get started:

This code snippet along with the API key will help us run predictions on our current data set. We currently have around 7000 customers who already have health insurance who we want to see will be interested in purchasing auto insurance.

Let's go ahead and import the necessary python packages. Then we will go ahead and read in the population we want to predict into a dataframe.
import pandas as pd
import requests
df = pd.read_csv("~/YOUR-PATH/test.csv")
- Pandas library lets us read the csv file in as a dataframe
- Requests library lets us make REST API calls to our Heimdall endpoint
- df is the dataframe object which holds our test file
We can now use the sample code we got from Heimdall model details to run a for loop to get the predictions we need.
url = 'https://predict.heimdallapp.org/predict/'
headers = {
'X-api-key': 'API-KEY',
'X-username': 'joelreji',
'x-model-id': '6514944db7e39ef5769d60f4'
}
responses = []- We will point to the Heimdall predict endpoint
- Set the necessary headers - make sure you put your unique API key here
- Create an empty array to hold our responses
for index, row in df.iterrows():
data = {
"features": {
"features": {
"Gender": row['Gender'],
"Age": row['Age'],
"Driving_License": row['Driving_License'],
"Region_Code": row['Region_Code'],
"Previously_Insured": row['Previously_Insured'],
"Vehicle_Age": row['Vehicle_Age'],
"Vehicle_Damage": row['Vehicle_Damage'],
"Annual_Premium": row['Annual_Premium'],
"Policy_Sales_Channel": row['Policy_Sales_Channel'],
"Vintage": row['Vintage'],
}
}
}
response = requests.post(url, headers=headers, json=data)
responses.append(response.json())Now we will actually loop through each row in the dataframe and send each row's values to the Heimdall predict endpoint by making a post request. We will append the response we get from the endpoint to an array so we can append it to our dataframe.
response_series = pd.Series(responses, name='API_Response')
df = pd.concat([df, response_series], axis=1)
dfFinally, we will convert the response array to a series object named 'API_Response'. We can then concatenate this series object to the pandas dataframe so that we can line up each insurance ID with the API response. Our next step as an insurance business would be to identify all insurance ID's which have a "1" for their "API_Response" column. Once we have a list of these insurance id's, we officially have a target group whom we can reach out to who will be interested in purchasing a auto insurance policy from us.
It's important to note that not all of these insurances will pan out, but now we have a targeted group on which we can focus more time on upselling. By using Heimdall, we quickly built & deployed a model to solve for our specific need. We then used the deployed model to make predictions on new customers that the model hasn't seen before.
Heimdall – Harness the Power of ML
Heimdall is an automatic machine learning platform that gives you (and your team) a ML backend to build incredible user experiences that are powered by machine learning. It offers quick and efficient model building with even quicker model deployment. Heimdall allows your teams to quickly ideate and build out ML products 80% faster.
Heimdall scales from weekend projects to enterprise needs. Contact us today to be ready to compete in the digital age.

