Allstate Auto Insurance Claims Severity Prediction

Posted on Sep 26, 2017

Introduction

The aim of the Allstate Claim Severity project is twofold, first to predict the severity of insurance claims, and second to help the company to evaluate potential clients based on the importance of predictors.

Understanding Data

The data is provided by the company-a training data set with 188,318 rows and a testing data set with 125,546 rows. The training data set consists of 188,318 observations and 131 variables which include 72 binary categorical variables, 43 non-binary variables with 3-326 levels, 14 continuous variables and the outcome variable, "loss". Since all the predictor variables are anonymized, no specific information about them are disclosed. There are no missing values.

To begin with, I checked the normality of the continuous values, and found out that the outcome variable, "loss", is right skewed, and the majority of it has the range of 0-15000.

Next, I mapped the correlation of continuous variables. Although some of variables are highly correlated, PCA found none variable that is not useful in explaining variation in the data set-- in this case, usefully differentiates between groups of original explanatory variables, so I kept all the continuous variables.

 

Feature Engineering

To prepare the training data set for analysis and modeling, I first conducted the log transformation on "loss" to normalize its distribution and remove its right skewness. Then, I dummified the categorical variables and got rid of near zero variables, using more conservative method to avoid removing important variables. Last, I splitted the training data set into the training and testing set with a ratio of 8:2.

Evaluating Algorithms

The outcome variable, "loss", is continuous, so this is a regression problem. I chose to use RMSE to evaluate model accuracy. RMSE or Root Mean Squared Error is the average deviation of the predictions from the observations. It is useful to get a gross idea of how well (or not) an algorithm is doing.

The most commonly used algorithms for regression problems are linear regression, ridge regression, lasso regression, random forest, and boosting. Caret package is one of the best in tuning algorithm parameters and get the best performance from the algorithms. Its default metric for regression is RMSE. Since the data is not too small, I implemented the cross validation with 3 repeats via Caret control function.

The following are two examples of training setup for gradient boosting and extreme boosting models in Caret:

 

Result and Summary

As of this writing, Caret is still tuning random forest model. After I aggregated the results I have and selected tuning parameters, xgblinear looks to be the best fit for the data set due to the smallest RMSE(test).

Through feature importance function I found out that cat80.D, cat79.D, CAT12.A, CAT80.B AND CONT14 are the most important predictor variables in the model.

I'll let Caret keep tuning random forest model, and when it completes the job, I'll combine predictions of different caret models using caretEnsemble package. Although it will increase computational time and complexity for building models, it will also provide more accurate estimates of model performance and help company better predict the loss severity and evaluate potential clients.

 

 

About Author

Maggie Zou

Maggie Zou got a masters' degree in Math education and has been teaching Math and science in local school district for the past ten years . She also works as an interpreter on the side for the governments...
View all posts by Maggie Zou >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI