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.9.0a1.tar.gz (65.5 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.9.0a1-py3-none-any.whl (107.3 kB view details)

Uploaded Python 3

File details

Details for the file neptune_query-1.9.0a1.tar.gz.

File metadata

  • Download URL: neptune_query-1.9.0a1.tar.gz
  • Upload date:
  • Size: 65.5 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.9.0a1.tar.gz
Algorithm Hash digest
SHA256 04c7245ec0fb2f804b54ab5fc826ba558c9295c28b922cda9be5bc0b5aa43b00
MD5 a46e18c9af854c2f94663b25fe95f46f
BLAKE2b-256 2e3901133f5cd36a42b3ed8226610502da89d0e11e59ffdfd1025d3547b2fbde

See more details on using hashes here.

File details

Details for the file neptune_query-1.9.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for neptune_query-1.9.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 505990bf5d41565e89e01a4adeb557896aa2ede3a81e72d14f3e2623af24141d
MD5 4b84e685615cad58a4e4e88d36aa077c
BLAKE2b-256 2df3b2c2d60e72d3e3e7088178dc47143fbe93873f17c376ef0cdae872007a5c

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