Machine Learning

A collection of articles on Machine Learning that teach you the concepts and how they’re implemented in practice.

Getting Started with Kaggle

Kaggle is a website located at https://kaggle.com that markets itself as being the place to do data science projects.

It has five primary offerings:

  1. Competitions - Kaggle hosts many different types of competitions, with a range of problems requiring different levels of skill to solve. These range from featured competitions which are full-scale challenges and often offer prizes up to as high as a million dollars, all the way to getting started competitions which are relatively easy and serve as a good entry into the competition format.
  2. Datasets - Many people end up on the Kaggle website when using search engines in pursuit of datasets. There is a wealth of datasets from a range of domains which can support a variety of interesting projects. What strengthens this offering is that the datasets include good documentation, a built-in discussion system which can act as a useful knowledge-base, and easily accessible code from community contributors which do interesting things with the data itself.
  3. Kernels - To conduct your data science experiments you 'll often need an environment with an installation of your programming language of choice, complete with some kind of scientific stack. With Kaggle Kernel's, you can get started on the actual data science without having to worry about maintaining your own local installation - It operates entirely through the web browser! This has the benefit of being a cloud environment which facilitates reproducible code and collaboration. Of course, once you have a good understanding of your needs, it will always be better to invest in your own hardware and local environment.
  4. Discussion - The website is backed by a strong community, and this is evident in the discussion areas offered by the website. You can visit one of the many forum areas, e.g. Questions & Answers which is for requesting technical advice from other data scientists, to a feedback area where you can request new features or discuss existing ones.
  5. Learn - You may want to pick up a new skill related to data science, or simply re-cap on an existing one. Kaggle offers free and short courses in data science, from learning SQL, to gaining some Data Visualisation knowledge to get useful representations of your data and results.

Getting started

Let's go through the process of signing up to Kaggle and firing up a Kernel to execute a Hello World program in Python.

Kaggle user sign-up form

The https://kaggle.com user sign-up form.

Direct your browser to https://kaggle.com and register your account using one of the sign-up approaches, if you agree to their terms. You will need to activate your account via a verification e-mail which should arrive immediately.

In the top navigation, click Notebooks. You will be presented with a list ofpublic Notebooks submitted and maintained by the community - this may be aninteresting source of knowledge for you, to see how other data scientists dothings.

In the top right, click the New Notebook button, which will allow you to pick between two types of development environment: Script and Notebook. These behave differently in the way the code is executed and how variables are handled during runtime. Let 's pick Notebook for the time-being, but you may wish to explore Script too.

Starting a new kernel

Starting a new Kaggle Notebook and choosing between the Script or Notebook type.

Once you have selected your Kernel type, you will be taken to a new notebook loaded into the Kaggle Notebook environment. Here you can enter your code directly, whether it is in Python or R which can be toggled using a dropdown in the interface. On the right-hand side you will see various widgets which include Session Information, Versioning, Information, Data Sources, Settings, Documentation, and a link to the API.

New notebook

Notebook loaded into the Kaggle Notebook environment.

To implement and run our Hello World program, let 's first remove the code in the existing cell. You can click inside the first cell, select all the code, and hit delete/backspace on your keyboard. Now you're ready to write your program. Type in the following code:

print("Hello World")

and click the Play button to the left of the cell to execute it. You should see the output appear below the cell, "Hello World"!

Hello world notebook

A simple Hello World program written in Python within a Kaggle Notebook.

That's all there is to getting your Hello World program running within a Kaggle Notebook. If you need to brush up on your Python skills, you can also check out one of the free courses mentioned earlier in this article: https://www.kaggle.com/learn/python.

Print hello world

Adding a new cell

To add a new code cell and get it's output, then we need to click on the blue "+" buttons. The one with an arrow up adds a cell above the current cell, and the one with an arrow down adds a cell below the current cell:

Add new cells

Next

In the next article we'll have a look at using a Kaggle Notebook for some machine learning tasks.

Comments

From the collection

Machine Learning

A collection of articles on Machine Learning that teach you the concepts and how they’re implemented in practice.