Book Image

The Kaggle Workbook

By : Konrad Banachewicz, Luca Massaron
5 (1)
Book Image

The Kaggle Workbook

5 (1)
By: Konrad Banachewicz, Luca Massaron

Overview of this book

More than 80,000 Kaggle novices currently participate in Kaggle competitions. To help them navigate the often-overwhelming world of Kaggle, two Grandmasters put their heads together to write The Kaggle Book, which made plenty of waves in the community. Now, they’ve come back with an even more practical approach based on hands-on exercises that can help you start thinking like an experienced data scientist. In this book, you’ll get up close and personal with four extensive case studies based on past Kaggle competitions. You’ll learn how bright minds predicted which drivers would likely avoid filing insurance claims in Brazil and see how expert Kagglers used gradient-boosting methods to model Walmart unit sales time-series data. Get into computer vision by discovering different solutions for identifying the type of disease present on cassava leaves. And see how the Kaggle community created predictive algorithms to solve the natural language processing problem of subjective question-answering. You can use this workbook as a supplement alongside The Kaggle Book or on its own alongside resources available on the Kaggle website and other online communities. Whatever path you choose, this workbook will help make you a formidable Kaggle competitor.
Table of Contents (7 chapters)

Building a baseline model

We start our approach by building a baseline solution. The notebook running an end-to-end solution is available at:

While hopefully useful as a starting point for other competitions you might want to try, it is more educational to follow the flow described in this section, i.e. copying the code cell by cell, so that you can understand it better (and of course improve on it - it is called a baseline solution for a reason).

Figure 3.2: the imports needed for our baseline solution

We begin by importing the necessary packages - while personal differences in style are a natural thing, it is our opinion that gathering the imports in one place makes the code easier to maintain as the competition progresses and you move towards more elaborate solutions. In addition, we create a configuration class: a placeholder for all the parameters defining our learning process:

Figure 3.3: configuration class for our baseline solution

The components include:

  • The data folder...