Search & Export data¶
Comet provides an extensive REST API and a Python API object to help you search and export your Comet data. Our goal is to provide a method to perform programmatically any action you can perform in the UI as well as access any logged data.
There are two steps to using the Python API method:
- Find the Experiment you wish to access using the
API.query()
orAPI.get()
methods, both of these methods will return anAPIExperiment()
. - Use the
APIExperiment()
methods to access the data logged to this experiment.
Get Experiments¶
Get Experiment by Key¶
If you would like to find a single Experiment and you know it's Experiment Key (it can be found in the Single Experiment Page), the easiest way to access the Experiment is using the API.get()
method:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Get all Experiments in a project¶
To get all the Experiments in a workspace or project, you can use the API.get_experiments()
method which will return a list of APIExperiment()
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
Search for Experiments¶
If you would like to find a set of experiments or find a specific experiments but don't have access to the Experiment Key, you can use the API.query()
method:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
The query condition follows the format ((QUERY-VARIABLE OPERATOR VALUE) & ...)
or (QUERY-VARIABLE.METHOD(VALUE) & ...)
with the following possible value:
QUERY-VARIABLE
:Environment(NAME)
,Metric(NAME)
,Parameter(NAME)
,Other(NAME)
,Metadata(NAME)
, orTag(VALUE)
.OPERATOR
:==
,<=
,>=
,!=
,<
or>
METHOD
:between()
,contains()
,startswith()
orendswith
Value
: Can bestring
,boolean
,double
ordatetime
. When usingdatetime
, be aware that the backend is using UTC datetimes.
You can use the following query strings as inspiration for your own queries:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
Export Experiment data¶
Once you have an APIExperiment object using one of the methods described above, you can use one of the many APIExperiment methods to both access and edit the data logged to an Experiment.
The most commonly used methods include:
APIExperiment.get_parameters_summary()
: Used to get a summary of the parameters logged.APIExperiment.get_metrics_summary()
: Used to get a summary of the metrics logged.APIExperiment.get_metrics()
: Used to get Experiment metrics.APIExperiment.get_model_asset_list()
: Used to get a list of the model files logged.APIExperiment.get_asset()
: Used to download an asset using theasset_id
that can be retrieved usingAPIExperiment.get_model_asset_list()
orAPIExperiment.get_asset_list()
.
You can find a full list of available methods in the APIExperiment
reference documentation.