Kaggle's Allstate claims severity data challenge
Kaggle had a competition called Allstate claims severity. Allstate provided the training and test data that contained continuous and categorical data. The portion of which can be seen below.
Categorical data was denoted by “cat” and “cont” for continuous. The total number of continuous and categorical can be observed in the table below
There were different types of categories in the dataset. The lowest number of categories were 2 and the highest was 326. These can be observed in the following images.
The following image shows the distribution of the continuous data.
Analysis showed that the data set had multi collinearity and if not corrected it could lead to overfitting the model. In order to remove multi collinearity, Variance Influence Factor (VIF) was used to remove predictors that had a correlation with other predictors. Predictors with VIF greater then 5 were removed.
Another issue that kept on coming up was that a few categorical predictors did not have the same factors in both the training and test set. These predictors were also removed.
Once removed, the categorical dataset was changed to numerical quantity using one-hot encoding.
Multiple regression, Lasso, Ridge and Elastic net
Multiple regression was straight forward and resulted in a model of R2 = 0.4817. It felt intuitive to try using ridge, lasso and elastic net. However after running the techniques, the MSE for all the models showed that Ridge Regression performed better.
Despite Ridge being a clear winner, the MSE was too high. XGBoost was used to see if a better model could be predicted. The parameter for XGBoost was set to
First the best tree iteration was selected through CV. The best iteration was train-mlogloss:0.114459+0.000355 test-mlogloss:0.124675+0.001603. The predicted model had the test error of 0.0314.
When the dataset was uploaded to Kaggle, the multiple linear model had the best score compared to XGBoost. It was mind boggling as to how that was possible and due to lack of time, I was unable to figure it out. Revisiting the project, I came to realize that MLR has its own way of converting categorical features into relevant features. Due to some intermediate model I was generating I forgot to combine the one hot encoded categorical data with the continuous. This could have resulted in such complex models. If I had more time on my hands I could have rerun the models and tried fixing the models.