Skip to main content

I failed in the recent AV hackathon and learned two things

Introduction:

This week, I took part in a competition playfully and thought that I will spend a good weekend on this problem. But the competition grew complex from a simple enough problem and ended up me being tackled by the problem; instead of me tackling the problem. This article will summarize my mistakes and the 2 specific things I learned from this.

Summary of the article:

Recently I took part in a hackathon, and tried my ml expertise with a tabular data. But for some reasons, I wasn't able to tackle the problem. The main findings were I used a wrong encoding method, as well as didn't do enough model testing.

The good:

In this project, the problem was to predict for a healthcare company whether they will get a customer or not; based on different policy based data. The dataset consisted of different data about the customer and policy amount etc. The customer related data were maximum and minimum ages mentioned in the policy, for how many years the policy have been working, city code, region code etc. For policy related data, the policy amount suggested, health indicator code, policy code etc were mentioned.

In the basic modeling, I left the city and region code as they were high cardinality categorical features. I created a bunch of features after understanding the data. And then tried 4 models: xgboost, random forest, extratrees forest and light gbm classifier.

With these, I reached around 60% score. Important thing to note here was, the data was imbalanced and therefore we needed to use class weights to get from 50% to 60% performance.

Also, in this exercise, I fine tuned a light gbm model. It took me sometime to read the documentation and tune it; but that improved around 2-3% accuracy.

Also, another important observation was that, the extratrees classifier performed better than random forest. According to me, because of higher number of categorical features, the extra trees classifier performed better.

The bad:

Then, near around 61% roc_auc_score, the things started to go bad. First of all, random forest, xgboost never reached above 63% on starting to add the city and region code ( the categorical features I left at the first portion of modeling). This is when I started fine tuning the light gbm model. 

The missed opportunity:

Around in 5-6 hr into the problem, I realized that the model is not getting up the curve because of high sparseness of the data from high cardinal categorical features. The problem was that although I read about label encoding for solving this, I chose to try my hand with PCA to compactify the signal.

From around 4k features, I used PCA and compacted 99.99% variance of the data into a little 300 features. This and the lgbm modeling made me reach the final score I reached(72.5%).

What are the learning?

The trick in this competition was to use catboost model with label encoding method. Both of these stuffs I thoroughly managed to miss out. I have been religiously using one hot encoding from the beginning of time; and this hackathon was a eye-opener for me on the fact that, like trying out multiple modeling, one need to try out all the available types of encoding methods. Also, in case of high cardinality categorical data, it is advisable to use label encoding as it seems from my study now. Another thing was catboost model. I had for some reason a very wrong intuition that as xgboost is failing so would the other boosters. But as catboost stands for categorical boosting; should have tried my hand with it. 

The silverlining:

This competition was an eye-opener. Due to desperation of not getting to 80%, I really dived deep into feature and tuned the number of pca based features. Also, this was first time for me to tune a light gbm model to almost perfect tune (manually done). And the best silverlining was to learn 2 big mistakes in one fall. 

The best solutions:

Needless to say, after so much rant, you deserve to hear from the bests. So here is the link to a few of the best solutions.

(a) Rank 2 solution to the problem

(b)  Rank 5 solution

(c) Rank 10 solution

(d) The magic solution by shobhit upadhyay 

I hope you liked the story and learned a thing or two!

Comments

Popular posts from this blog

Tinder bio generation with OpenAI GPT-3 API

Introduction: Recently I got access to OpenAI API beta. After a few simple experiments, I set on creating a simple test project. In this project, I will try to create good tinder bio for a specific person.  The abc of openai API playground: In the OpenAI API playground, you get a prompt, and then you can write instructions or specific text to trigger a response from the gpt-3 models. There are also a number of preset templates which loads a specific kind of prompt and let's you generate pre-prepared results. What are the models available? There are 4 models which are stable. These are: (1) curie (2) babbage (3) ada (4) da-vinci da-vinci is the strongest of them all and can perform all downstream tasks which other models can do. There are 2 other new models which openai introduced this year (2021) named da-vinci-instruct-beta and curie-instruct-beta. These instruction models are specifically built for taking in instructions. As OpenAI blog explains and also you will see in our

Can we write codes automatically with GPT-3?

 Introduction: OpenAI created and released the first versions of GPT-3 back in 2021 beginning. We wrote a few text generation articles that time and tested how to create tinder bio using GPT-3 . If you are interested to know more on what is GPT-3 or what is openai, how the server look, then read the tinder bio article. In this article, we will explore Code generation with OpenAI models.  It has been noted already in multiple blogs and exploration work, that GPT-3 can even solve leetcode problems. We will try to explore how good the OpenAI model can "code" and whether prompt tuning will improve or change those performances. Basic coding: We will try to see a few data structure coding performance by GPT-3. (a) Merge sort with python:  First with 200 words limit, it couldn't complete the Write sample code for merge sort in python.   def merge(arr, l, m, r):     n1 = m - l + 1     n2 = r- m       # create temp arrays     L = [0] * (n1)     R = [0] * (n

What is Bort?

 Introduction: Bort, is the new and more optimized version of BERT; which came out this october from amazon science. I came to know about it today while parsing amazon science's news on facebook about bort. So Bort is the newest addition to the long list of great LM models with extra-ordinary achievements.  Why is Bort important? Bort, is a model of 5.5% effective and 16% total size of the original BERT model; and is 20x faster than BERT, while being able to surpass the BERT model in 20 out of 23 tasks; to quote the abstract of the paper,  ' it obtains performance improvements of between 0 . 3% and 31%, absolute, with respect to BERT-large, on multiple public natural language understanding (NLU) benchmarks. ' So what made this achievement possible? The main idea behind creation of Bort is to go beyond the shallow depth of weight pruning, connection deletion or merely factoring the NN into different matrix factorizations and thus distilling it. While methods like knowle