Giter Club home page Giter Club logo

allstate-insurance-predicting-claim-severity-xgboost-ml's Introduction

Machine Learning Project: Predicting Claim Severity for Allstate Insurance (Kaggle Competition)

The purpose of this project is to predict the continuous variable ‘loss’ which quantifies the severity of a claim to the insurance company. The information in this dataset has been completely stripped of its business context and simply contains both categorical and continuous attributes without any variable descriptions or hints. There are 116 categorical variables (named cat1-cat116) and 14 continuous attributes (named cont1-cont14).

The broad steps involved in solving this problem -

Summarized the data by using dimension reduction techniques like PCA

I first performed correlation analysis on the subset of numeric variables (14 of them) in the dataset to exclude variables having more than 89% correlation. Second, I took a subset of variables having less than 9 category levels and performed a categorical principle component analysis on them to reduce their dimention by removing redundant variables. Third, I took all the above 9-category-level variables and converted them into numeric. This helped transform the entire dataset to having contnuous variables.

Performed feature engineering to transform the target variable to normal distribution

I plotted the target variable (loss) to visualize its distribution and I saw that it was quite heavily skewed. To correct for that, I transformed the variable using log transformations to achieve a more symmetrical distribution. This helped improve the prediction too.

Built a xgboost model in R to predict the proxy variable for claims severity to the insurance company

I used an xgboost model in R to predict the continuous variable, loss. This model uses the GBM framework but works 10 times faster than the gradient boosting model It is good in many ways, to name a few-

  1. Parallel Computing: It is enabled with parallel processing (using OpenMP); i.e., when you run xgboost, by default, it would use all the cores of your laptop/machine.
  2. Regularization: I believe this is the biggest advantage of xgboost. GBM has no provision for regularization. Regularization is a technique used to avoid overfitting in linear and tree-based models.
  3. Enabled Cross Validation: In R, we usually use external packages such as caret and mlr to obtain CV results. But, xgboost is enabled with internal CV function
  4. Tree Pruning: Unlike GBM, where tree pruning stops once a negative loss is encountered, XGBoost grows the tree upto max_depth and then prune backward until the improvement in loss function is below a threshold.

Tuned the model parameters to obtain optimized predictive ability

I first used the in-built xgb.cv function to find the best nrounds for the defaults parameter model. I then ran then trained the xgboost model with the default parameters and the best nrounds value. I used the predict funtion to predict the loss values given by the model and then checked their accuracy against the actual values using the mean absolute error metric.

allstate-insurance-predicting-claim-severity-xgboost-ml's People

Contributors

sanyagoyal avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.