Context

Context is an entry point for Neptune in your source code.

Creating Context

To create Neptune Context all you need to do is:

1
2
3
import neptune

ctx = neptune.Context()

Note

In Notebooks, Neptune Context is created behind the scene. You can access it using the ctx variable.

Accessing Parameters

Neptune Context has a params object. params contains all parameter values passed to Neptune via parameters section either in config file or in command line. You can access a parameter using its name:

1
2
3
4
# object notation
param_x = ctx.params.x
# dict notation
param_x = ctx.params['x']

Accessing the Metric

Metric is a way to tell Neptune how to select the best experiment in your grid search. To access it use:

1
ctx.metric

Resetting Context

If you want to delete all channels and start everything anew, you can reset the context by using:

1
ctx.reset()