Python Panels SDK APIExperiment

This page documents the comet_ml.APIExperiment for Comet Python Panels.

Other Python Panel Resources:


APIExperiment

The APIExperiment class for use in Comet Python Panels.

It is best not to call this constructor directly but to use an API method such as:

python experiment = api.get_experiment_by_key(KEY)

APIExperiment.name

Get the name of the experiment.

Example:

python experiment = api.get_experiment_by_key(KEY) print(experiment.name)

APIExperiment.url

Get the url of the experiment.

Example:

```python

api_experiment.url "https://www.comet.ml/username/34637643746374637463476" ```


APIExperiment.__init__

python __init__(self, API=None, experiment_key=None, metadata=None)

Initialize self. See help(type(self)) for accurate signature.


APIExperiment.get_additional_system_info

python get_additional_system_info(self)

Get the associated additional system info for this experiment.

Example:

```python

api_experiment.get_additional_system_info() [] ```


APIExperiment.get_asset

python get_asset(self, asset_id, return_type="binary")

Get an asset, given the asset_id.

Args:

  • asset_id: the asset ID
  • return_type: the type of object returned. Default is "binary". Options: "binary" or "text"

Example:

```python

api_experiment.get_asset("298378237283728", return_type="json") {...} ```


APIExperiment.get_asset_list

python get_asset_list(self, asset_type="all")

Get a list of assets associated with the experiment.

Args:

  • asset_type: Optional String, type of asset to return. Can be "all", "image", "histogram_combined_3d", "video", or "audio".

Returns a list of dictionaries of asset properties, like:

```python

from comet_ml.api import API api = API() x = api.get("myworkspace/project1/experiment_key") x.get_asset_list() [{'fileName': 'My Filename.png', 'fileSize': 21113, 'runContext': None, 'step': None, 'link': 'https://www.comet.ml/api/asset/download?experimentKey=KEY&assetId=ASSET_ID', 'createdAt': 1565898755830, 'dir': 'assets', 'canView': False, 'audio': False, 'video': False, 'histogram': False, 'image': True, 'type': 'image', 'metadata': None, 'assetId': ASSET_ID}, ...]

x.get_asset_list("image") [{'fileName': 'My Filename.png', 'fileSize': 21113, 'runContext': None, 'step': None, 'link': 'https://www.comet.ml/api/asset/download?experimentKey=KEY&assetId=ASSET_ID', 'createdAt': 1565898755830, 'dir': 'assets', 'canView': False, 'audio': False, 'video': False, 'histogram': False, 'image': True, 'type': 'image', 'metadata': None, 'assetId': ASSET_ID}, ...] ```


APIExperiment.get_code

python get_code(self)

Get the associated source code for this experiment.

Example:

```python

api_experiment.get_code() 'import comet_ml experiment = comet_ml.Experiment() experiment.end()' ```


APIExperiment.get_command

python get_command(self)

Get the associated command-line script and args for this experiment.

Example:

```python

api_experiment.get_command() ['keras.py', '--size', '1024', '--log', 'experiment.log'] ```


APIExperiment.get_curves

python get_curves(self)

Get all curve assets as JSON.

Example:

```python

api_experiment.get_curves() [...] ```


APIExperiment.get_executable

python get_executable(self)

Get the associated executable for this experiment.

Example:

```python

api_experiment.get_executable() '/usr/local/bin/python' ```


APIExperiment.get_gpu_static_info

python get_gpu_static_info(self)

Get the system details associated with this experiment.


APIExperiment.get_hostname

python get_hostname(self)

Get the system details associated with this experiment.


APIExperiment.get_html

python get_html(self)

Get the HTML associated with this experiment.

Example:

```python

api_experiment.get_html() "Hello, world!" ```


APIExperiment.get_images

python get_images(self)

Get all image assets as bytes.

Example:

```python

api_experiment.get_images() [...] ```


APIExperiment.get_installed_packages

python get_installed_packages(self)

Get the associated installed packages for this experiment.

Example:

```python

api_experiment.get_installed_packages() ['absl-py==0.8.1', 'adal==1.2.2', 'alabaster==0.7.12', ...] ```


APIExperiment.get_ip

python get_ip(self)

Get the associated IP for this experiment.

Example:

```python

api_experiment.get_ip() '175.29.200.91' ```


APIExperiment.get_machine

python get_machine(self)

Get the associated total RAM for this experiment.

Example:

```python

api_experiment.get_machine() 'AMD64' ```


APIExperiment.get_max_memory

python get_max_memory(self)

Get the associated max total memory for this experiment.

Example:

```python

api_experiment.get_max_memory() 1024 ```


APIExperiment.get_metadata

python get_metadata(self)

Get the metadata associated with this experiment.

Example:

```python

api = API(...) api_experiment = APIExperiment(API=api, experiment_key="EXPERIMENT-KEY") api_experiment.get_metadata() { "archived": False, "durationMillis": 7, "endTimeMillis": 1586174765277, "experimentKey": "EXPERIMENT-KEY", "experimentName": None, "fileName": None, "filePath": None, "optimizationId": None, "projectId": "PROJECT-ID", "projectName": "PROJECT-NAME", "running": False, "startTimeMillis": 1586174757596, "throttle": False, "workspaceName": "WORKSPACE-NAME", }

To assign metadata to a variable, use await:

meta = await api_experiment.get_metadata() print(meta) ```


APIExperiment.get_metrics

python get_metrics(self, metric=None)

Get all of the logged metrics. Optionally, just get the given metric name.

Args:

  • metric: Optional. String. If given, filter the metrics by name.

Example:

```python

api = API(...) x = api.get("myworkspace/project1/experiment_key")

x.get_metrics() [{"metricName": "val_loss", "metricValue": "0.13101346811652184", "timestamp": 1558962376383, "step": 1500, "epoch": None, "runContext": None}, {"metricName": "acc", "metricValue": "0.876", "timestamp": 1564536453647, "step": 100, "epoch": None, "runContext": None}, ...]

x.get_metrics("acc") [{"metricName": "acc", "metricValue": "0.876", "timestamp": 1564536453647, "step": 100, "epoch": None, "runContext": None}, ...] ```


APIExperiment.get_metrics_summary

python get_metrics_summary(self, metric=None)

Return the experiment metrics summary. Optionally, also if you provide the metric name, the function will only return the summary of the metric.

Args:

  • metric: optional (string), name of a metric

Examples:

```python

api = API(...) x = api.get("myworkspace/project1/experiment_key") x.get_metrics_summary() [{"name": "val_loss", "valueMax": "0.24951280827820302", "valueMin": "0.13101346811652184", "valueCurrent": "0.13101346811652184", "timestampMax": 1558962367938, "timestampMin": 1558962367938, "timestampCurrent": 1558962376383, "stepMax": 500, "stepMin": 1500, "stepCurrent": 1500}, ...]

api.get_metrics_summary("val_loss") {"name": "val_loss", "valueMax": "0.24951280827820302", "valueMin": "0.13101346811652184", "valueCurrent": "0.13101346811652184", "timestampMax": 1558962367938, "timestampMin": 1558962367938, "timestampCurrent": 1558962376383, "stepMax": 500, "stepMin": 1500, "stepCurrent": 1500} ```


APIExperiment.get_model_asset_list

python get_model_asset_list(self, model_name)

Get an experiment model's asset list by model name.

Args:

  • model_name: str, the name of the model

Returns: a list of asset dictionaries with these fields:

  • fileName
  • fileSize
  • runContext
  • step
  • link
  • createdAt
  • dir
  • canView
  • audio
  • histogram
  • image
  • type
  • metadata
  • assetId

Example:

```python

from comet_ml import API api = API() api_exp = api.get("workspace/project/765643463546345364536453436") api_exp.get_model_asset_list("Model Name") [ { "assetId": 74374637463476, "audio": False, "canView": False, "createdAt": 7337347634, "dir": "trained-models", "fileName": "model.h5", "fileSize": 254654, "histogram": False, "image": False, "link": "https://link-to-download-asset-file", "metadata": None, "remote": False, "runContext": "train", "step": 54, "type": "asset", } ] ```


APIExperiment.get_model_graph

python get_model_graph(self)

Get the associated graph/model description for this experiment.

Example:

```python

api_experiment.get_model_graph() {"class_name": "Sequential", ...} ```


APIExperiment.get_model_names

python get_model_names(self)

Get a list of model names associated with this experiment.

Returns: list of model names


APIExperiment.get_name

python get_name(self)

Get the name of the experiment, if one.

Example:

```python

api_experiment.get_name() "My Name" ```


APIExperiment.get_network_interface_ips

python get_network_interface_ips(self)

Get the associated network interface IPs for this experiment.

Example:

```python

api_experiment.get_network_interface_ips() ['127.0.0.1', '10.0.0.71', ...] ```


APIExperiment.get_os

python get_os(self)

Get the associated OS for this experiment.

Example:

```python

api_experiment.get_os() 'Linux-4.15.0-1059-oem-x86_64-with-Ubuntu-18.04-bionic' ```


APIExperiment.get_os_packages

python get_os_packages(self)

Get the OS packages for this experiment.

Example:

```python

api_experiment.get_os_packages() ['accountsservice=0.6.45-1ubuntu1', 'acl=2.2.52-3build1', 'acpi-support=0.142', ...] ```


APIExperiment.get_os_release

python get_os_release(self)

Get the associated OS release for this experiment.

Example:

```

api_experiment.get_os_release() '8' ```


APIExperiment.get_os_type

python get_os_type(self)

Get the associated os type for this experiment.

Example:

```python

api_experiment.get_os_type() 'Linux' ```


APIExperiment.get_others_summary

python get_others_summary(self, other=None)

Get the other items logged in summary form.

Args:

  • other: optional, string, the name of the other item logged. If given, return the valueCurrent of the other item. Otherwise, return all other items logged.

Examples:

```python

api = API(...) x = api.get("myworkspace/project1/experiment_key") x.get_others_summary() [{"name": "trainable_params", "valueMax": "712723", "valueMin": "712723", "valueCurrent": "712723", "timestampMax": 1558962363411, "timestampMin": 1558962363411, "timestampCurrent": 1558962363411}, ...]

x.get_others_summary("trainable_params") ["712723"] ```


APIExperiment.get_parameters_summary

python get_parameters_summary(self, parameter=None)

Return the experiment parameters summary. Optionally, also if you provide a parameter name, the method will only return the summary of the given parameter.

Args:

  • parameter: optional (string), name of a parameter

Examples:

```python

api = API(...) x = api.get("myworkspace/project1/experiment_key") x.get_parameters_summary() [{"name": "batch_size", "valueMax": "120", "valueMin": "120", "valueCurrent": "120", "timestampMax": 1558962363411, "timestampMin": 1558962363411, "timestampCurrent": 1558962363411}, ...]

x.get_parameters_summary("batch_size") {"name": "batch_size", "valueMax": "120", "valueMin": "120", "valueCurrent": "120", "timestampMax": 1558962363411, "timestampMin": 1558962363411, "timestampCurrent": 1558962363411} ```


APIExperiment.get_pid

python get_pid(self)

Get the pid for this experiment.

Example:

```python

api_experiment.get_pid() 34658 ```


APIExperiment.get_processor

python get_processor(self)

Get the associated total RAM for this experiment.

Example:

```python

api_experiment.get_processor() 'Intel64 Family 6 Model 60 Stepping 3, GenuineIntel ```


APIExperiment.get_python_version

python get_python_version(self)

Get the Python version for this experiment.

Example:

```python

api_experiment.get_python_version() '3.6.8' ```


APIExperiment.get_python_version_verbose

python get_python_version_verbose(self)

Get the Python version verbose for this experiment.

Example:

```python

api_experiment.get_python_version_verbose() '3.6.8 (default, Oct 7 2019, 12:59:55) [GCC 8.3.0]' ```


APIExperiment.get_tags

python get_tags(self)

Get the associated tags for this experiment.

Example:

```python

api_experiment.get_tags() ["best"] ```


APIExperiment.get_total_memory

python get_total_memory(self)

Get the associated total RAM for this experiment.

Example:

```python

api_experiment.get_total_memory() 1024 ```


APIExperiment.get_user

python get_user(self)

Get the associated user for this experiment.

Example:

```python

api_experiment.get_user() 'usename' ```