Skip to main content

Neptune Query is a Python library for retrieving data from Neptune.

Project description

Neptune Query API

The neptune_query package is a read-only API for fetching metadata tracked with the Neptune logging client.

With the Query API, you can:

  • List experiments, runs, and attributes of a project.
  • Fetch experiment or run metadata as a data frame.
  • Define filters to fetch experiments, runs, and attributes that meet certain criteria.

Installation

pip install "neptune-query<2.0.0"

Set your Neptune API token and project name as environment variables:

export NEPTUNE_API_TOKEN="ApiTokenFromYourNeptuneProfile"
export NEPTUNE_PROJECT="workspace-name/project-name"

For help, see Query metadata: Setup in the Neptune documentation.

Note: You can also pass the project path to the project argument of any querying function.

Usage

import neptune_query as nq

Available functions:

  • download_files() – download files from the specified experiments.
  • fetch_experiments_table() – runs as rows and attributes as columns.
  • fetch_metrics() – series of float or int values, with steps as rows.
  • fetch_series() – for series of strings or histograms.
  • list_attributes() – all logged attributes of the target project's experiment runs.
  • list_experiments() – names of experiments in the target project.
  • set_api_token() – set the Neptune API token to use for the session.
  • (experimental) fetch_metric_buckets() – get summary values split by X-axis buckets.

For details, see the API reference.

To use the corresponding methods for runs, import the Runs API:

import neptune_query.runs as nq_runs

You can use these methods to target individual runs by ID instead of experiment runs by name.

Example 1: Fetch metric values

To fetch values at each step, use fetch_metrics().

  • To filter experiments to return, use the experiments parameter.
  • To specify attributes to include as columns, use the attributes parameter.
nq.fetch_metrics(
    experiments=["exp_dczjz"],
    attributes=r"metrics/val_.+_estimated$",
)
                  metrics/val_accuracy_estimated  metrics/val_loss_estimated
experiment  step
exp_dczjz    1.0                        0.432187                    0.823375
             2.0                        0.649685                    0.971732
             3.0                        0.760142                    0.154741
             4.0                        0.719508                    0.504652

Example 2: Fetch metadata as one row per run

To fetch experiment metadata from your project, use the fetch_experiments_table() function:

nq.fetch_experiments_table(
    experiments=r"^exp_",
    attributes=["metrics/train_accuracy", "metrics/train_loss", "learning_rate"],
)
            metrics/train_accuracy   metrics/train_loss   learning_rate
experiment
exp_ergwq                 0.278149             0.336344            0.01
exp_qgguv                 0.160260             0.790268            0.02
exp_hstrj                 0.365521             0.459901            0.01

For series attributes, the value of the last logged step is returned.

Documentation


License

This project is licensed under the Apache License Version 2.0. For details, see Apache License Version 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neptune_query-1.8.0b3.tar.gz (65.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neptune_query-1.8.0b3-py3-none-any.whl (106.9 kB view details)

Uploaded Python 3

File details

Details for the file neptune_query-1.8.0b3.tar.gz.

File metadata

  • Download URL: neptune_query-1.8.0b3.tar.gz
  • Upload date:
  • Size: 65.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for neptune_query-1.8.0b3.tar.gz
Algorithm Hash digest
SHA256 57790672c9b71f1f8dddaa2eea5b1ad5abf11559569f416152c350176f74fdb3
MD5 165e8786a9fe3068fff1397004cffa63
BLAKE2b-256 3f76894690b1784a6978283b38ab529e43d5b5dcd0f9d1867a0991b8cf74beaa

See more details on using hashes here.

File details

Details for the file neptune_query-1.8.0b3-py3-none-any.whl.

File metadata

File hashes

Hashes for neptune_query-1.8.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 c5a6ce9e3202a68c6165a1fd9575d89c91b2fa498ea8e3526211cbcc3d14e76d
MD5 5352148893cae575ec55792ebe5ef6cc
BLAKE2b-256 0f8a89252d4be539fa2b2a5c13fb0a1b0cb9a52d63384a5216ae602a9fb9d902

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page