Use Neptune API to Iog your first experiment


This guide will show you how to:

  • Install neptune-client

  • Connect Neptune to your script and create the first experiment

  • Log metrics to Neptune and explore them in the UI

By the end of it, you will run your first experiment and see it in Neptune!

Before you start

Make sure you meet the following prerequisites before starting:

  • Have Python 3.x installed


You can run this how-to on Google Colab with zero setup.

Just click on the Open in Colab button on the top of the page.

Step 1 - Install neptune-client

Go to the command line of your operating system and run the installation command:

pip install neptune-client


If you are using R or any other language go read this.

Step 2 - Create a

Create a python script called and copy the code below to it:

# Connect your script to Neptune
import neptune


# Create experiment

# Log metrics to experiment
from time import sleep

neptune.log_metric('single_metric', 0.62)

for i in range(100):
    sleep(0.2) # to see logging live
    neptune.log_metric('random_training_metric', i * 0.6)
    neptune.log_metric('other_random_training_metric', i * 0.4)


Instead of logging data to the public project ‘shared/onboarding’ as an anonymous user ‘neptuner’ you can log it to your own project.

  1. Get your Neptune API token

    Get API token
  2. Pass the token to api_token argument of neptune.init() method: api_token=YOUR_API_TOKEN

  3. Pass your username to the project_qualified_name argument of the neptune.init() method: project_qualified_name='YOUR_USERNAME/sandbox. Keep /sandbox at the end, the sandbox project that was automatically created for you.

For example:


Step 3 - Run your script and explore results

Now that you have your script ready you can run it and see results in Neptune.

Run your script from the terminal or Jupyter notebook


Click on the link in the terminal or notebook or go directly to the Neptune app.

See metrics you logged in Logs, Charts, and hardware consumption in the Monitoring sections of the Neptune UI:


You’ve learned how to:

  • Install neptune-client

  • Connect Neptune to your python script and create an experiment

  • Log metrics to Neptune

  • Explore your metrics in Logs and Charts sections

  • See hardware consumption during the experiment run

What’s next

Now that you know how to create experiments and log metrics you can learn: