Hello Gradient Descent

Estimated time: 5 minutes

In this part of our introduction you will learn how to:

  • transform your logs into interactive charts;
  • send your computation to the cloud.

To run your first project, Hello Gradient Descent, you need to download the neptune-examples repository, either as zip file, or from the command line:

git clone https://github.com/neptune-ml/neptune-examples.git
cd neptune-examples/1-hello-gradient-descent

The main.py script minimizes a function f(x) with the gradient descent algorithm. To run it with Neptune on your own computer, execute:

neptune run

A dashboard tracking the progress of the experiment will open in your browser. Logs defined within the code appear in your terminal:

neptune run
# ...
# x 1.4 y -10.64
# x 2.52 y -21.9296
# x 3.416 y -29.154944

charts screenshot

This mini-project contains a short config file neptune.yaml:

log-channels: [x, y]

It’s a way of telling Neptune that it should treat strings like “x 3.14” and “y 2.71” printed to standard output specially - they should be converted to numeric channels.

Each channel is a sequence of numeric values, strings or images - which can be used to observe the progress of your machine learning model training. Neptune lets you view numeric channels as interactive charts.

You can experiment a bit with this feature by printing additional variables to the terminal, like the function’s gradient: df. Once you edit the code accordingly, you can configure your channels from command line:

neptune run -l x -l y -l df

Also, you can run exactly the same script in the cloud. It is as simple as:

neptune send -l x -l y -l df

Your experiment will now be executed on Google Cloud Platform and you can monitor its progress, as usual in Neptune’s UI.

Now let’s learn how to use Jupyter notebooks for your experiments in Neptune.