Winner Interview with Shivam Bansal | Data Science for Good Challenge: City of Los Angeles

Kaggle Team
Dec 4, 2019 · 9 min read

Originally published: 07.15.2019

The City of Los Angeles has partnered with Kaggle to create a competition to identify needed improvements in the City of LA’s job postings. In the interview below, competition winner Shivam Bansal shares his winning approach.

The Challenge

Q: Let’s start with the problem you solved. Can you summarize the competition for readers who are unfamiliar?

The business problem presented in this challenge was unique. More than one-third of the city’s 50,000 workers are eligible to retire in the coming year. In this situation, the organization wanted to learn from different datasets and core data science practices to ensure an efficient recruitment pipeline. They wanted to bring a structure in their job boards and optimize the content, tone, language, and format. All these factors can directly or indirectly influence the quality and diversity of the applicant pool.

LA’s Mayor wanted to reimagine the city’s job boards by using text analysis to identify needed improvements. The primary goal was to develop techniques to convert plain-text job postings into a single structured file, then to use it to identify language that can negatively bias the pool of applicants; further, improve the diversity and quality of the applicant pool; and make it easier to determine which promotions are available to employees in each job class. As an overall solution, they wanted a framework to address these challenges and suggest actionable recommendations with meaningful impact.

The Basics

Q: What was your background prior to entering this challenge?

When this competition was launched, I was pursuing my master’s degree from the National University of Singapore. Prior to that, I had worked as a data scientist and had experience in building the end to end data science solutions for different industries such as insurance, healthcare, and retail. In Kaggle, I am the kernels Grandmaster with the highest overall rank 2 and had won other two data science for good challenges before this one.

Q: Do you have any domain knowledge that helped you succeed in this competition?

This competition required some level of understanding about an effective recruitment process and related themes such as diversity hiring, unconscious or implicit bias, the importance of content, tone, and language, and identification of promotional pathways. I did not have a very deep understanding of these themes but I had some surface-level knowledge from other similar works. I believe this initial knowledge helped me kickstart things, especially in structuring my solution in the early days of the competition. Since the problem statement of the competition was highly unstructured in nature, it was important to break it down into smaller tasks and structure it very well. The initial knowledge at least helped me to break down the problem into smaller tasks.

Q: How did you get started competing on Kaggle?

I started my Kaggle journey mainly in the kernels section and even today I am most active in kernels. Whenever I wanted to learn a new concept, I always used to write about it in the form of blogs or an article. I thought of trying Kaggle kernels to share something about text data feature engineering and shared a kernel as part of a competition. To my surprise, this kernel was selected as one of the winners of the kernel awards. This motivated me to write and share more good quality and versatile kernels. In the subsequent months, I made more contributions and won a few more kernel awards, swag prizes and data science for good challenges wins.

Q: What made you decide to enter this competition?

The problem statement presented in this competition was very challenging and interesting. The bigger part of the problem was unstructured in nature and required a creative and innovative approach. This challenge demanded a complete solution in all aspects — code, documentation, workflow, pipelining, storytelling, modularity, reusability, visualizations, and use of core natural language processing. After reading more about the problem, I realized that this is a great opportunity to try, practice, and test the versatile data science, engineering and presentation skills.

Let’s Get Technical

Q: How did you approach the problem and structure your solution?

I structured my entire solution in five main parts and shared five respective kernels as part of the submission. The main goal of each of the five kernels was linked to a particular task in the overall problem statement.

In the first kernel, I developed an entire text-parsing framework from scratch to convert job bulletin text documents into structured entities and information. I focussed on developing the engine in a robust, generic, and clean manner. For the ease of usage and reusing, I also shared a python package called PyCola and hosted on PyPi. The following diagram shows the overall architecture of the engine.

In the second kernel, I shared a very deep analysis of unconscious bias in job bulletins and aspects related to diversity hiring. For validation of analysis and hypothesis, I added a simulation experiment. Additionally, I shared a mathematical formulation to quantify the unconscious gender bias present in job bulletins and recommendations to reduce them

In the third kernel, I performed a textual analysis for content, tone, and language of the job bulletins. For comparing and developing the benchmark for insights, I created an index from Fortune 500 companies data.

In the next two kernels, I shared an approach to identify insights about promotional pathways from the job bulletins in both implicit and explicit manner. The following diagram shows an example of promotional pathways obtained in explicit technique.

The indirect connections were obtained using contextual similarity among word embeddings generated from pre-trained fasttext models. The graphs were generated using d3.js and produced by the use of require.js in Kaggle kernels, which was further controlled by python.

What was your most important insight into the data?

The analysis showcases some of the interesting insights. A large proportion of jobs are tagged as moderate masculine while about 4% of the bulletins show very strong masculine. Only about 2% of the jobs are neutral. At an overall level, more than 90% of the jobs have more masculine content, almost none of the jobs have a feminine bias.

Roles like “Planner”, “Analyst”, “Architect”, “Programmer” showed high masculine bias. And it was interesting to note that the salaries offered for these roles are all on the higher ends as well. The average salary of roles having high masculine bias is about 102.7K while it is about 71K for roles having a low masculine bias.

The analysis also showed there was high usage of difficult and complex words (having more than three sounds) in the job bulletins. On an average every job description contained about 345 such keywords. In comparison to benchmark, only 135 keywords were used in bulletins.

These insights were only a few selected insights but my kernels 2 and 3 all the insights that were obtained from the analysis, and some of them were really useful, impactful, and unexpected. All of these insights were useful to make recommendations to the City of Los Angeles to optimize their current strategies in terms of writing job bulletins.

Which tools did you use?

My entire text-parsing engine was built using plain pure python. I did use a regular expression library but for very minimal purpose. Apart from it, general libraries like pandas and numpy were also used. For analysis of bias, content, tone, and language I used python’s libraries textblob for sentiment analysis, nltk for text cleaning, textstat (my own python package) for readability analysis, and spacy for NLP tasks. The majority of the data visualizations were generated using plotly and some in the seaborn library. Finally, in the last kernel, I used D3.js for tree-based visualizations and used Facebook’s word embedding library fasttext to generate pairwise similarities (from sklearn). The architecture of the last part is shown below:

How did you spend your time on this competition?

I approached this problem in a step by step manner. Initially, I created a high-level milestones plan for six weeks and created tasks like preparing the version 0 of the NLP engine, preparing the bias framework, writing the interpretations and explanations, writing validation engine etc. Later, I further created sub-tasks for every milestone.

I spent the first two weeks in developing a baseline end to end solution with average but complete results. For example, the NLP engine shared in the first kernel was developed in only three days, but the final results were very bad and noisy. In the next two weeks, I worked upon improvements which took a lot of effort and time. I had to write codes to detect the bad results, identify the root causes, identify the fixes, and update the codes. For analysis, I focussed on adding more visualizations, along with key insights and explanations. In the last two weeks, I focussed on further improvements, presentation, and making the relevant storyline of my solution. I only added my last kernel related to indirect promotional pathways in the last three days. I made sure that I completed my solution before the deadline and did not leave items for the last moments. Well, this really helped in creating a good solution.

Words of Wisdom

What have you taken away from this competition?

Though I started working on this competition slightly later than it was launched, I ended up getting the best possible result. This made me realize (once again in my life) that it is never too late to start, it’s all about taking the first step. Also, with all my effort and time spent in building my solution, I realized that if one gives 100% effort and dedication,, then they can definitely get a satisfactory outcome, no matter how challenging the task is.

Do you have any advice for those just getting started in data science?

Always try to break the data science problem into smaller chunks and try to solve it in an iterative process. The most important data science skills are applied and practical data science skills. The best way to become good data scientists is to practice the skills on platforms like Kaggle or GitHub. Most importantly, since data science is a big field, it is easy to get distracted. Hence, while learning new skills always try to stick to what you have started and try to complete it until the end.

Just for fun

If you could run a Kaggle competition, what problem would you want to pose to other Kagglers?

A competition for memes generation. It will be a fun competition in which generative models can be trained on a dataset of memes, and they can be used to generate new memes based on different contexts.

— -

Shivam Bansal is a data scientist with extensive cross-industry experience in areas of healthcare, insurance, banking, fintech, and retail. He recently completed his Master’s degree in the Business Analytics Center at the National University of Singapore. He is the Kaggle Kernels Grandmaster with the highest global rank of 2 and is the winner of three Data Science for Good Challenges. His areas of interests include end to end data science and analytics based architectures, language processing, deep learning, statistical machine learning, visual storytelling, and model explainability.

Kaggle Team

Written by

Official authors of Kaggle winner’s interviews + more! Kaggle is the world’s largest community of data scientists. Join us at

Kaggle Blog

Official Kaggle Blog ft. interviews from top data science competitors and more!

More From Medium

More on Kaggle from Kaggle Blog

More on Data Science from Kaggle Blog

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade