APIExperiment

APIExperiment

The APIExperiment class is used to access data from the Comet.ml Python API.

You can use an instance of the APIExperiment() class to easily access all of your logged experiment information at Comet.ml, including metrics, parameters, tags, and assets.

>>> from comet_ml.api import API, APIExperiment

## (assumes api keys are configured):
>>> comet_api = API()

## Get an APIExperiment from the API:
>>> experiment = comet_api.get("cometpublic/comet-notebooks/example 001")

## Make a new APIExperiment (assumes api keys are configured):
>>> experiment = APIExperiment(workspace="my-username",
  project_name="general")

## Get an APIExperiment for a previous experiment
## (assumes api keys are configured):
>>> experiment = APIExperiment(previous_experiment=EXPERIMENT_ID)

For more usage examples, see Comet Python API examples.

APIExperiment.url

Get the url of the experiment.

Example:

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

APIExperiment.__init__

__init__(self, *args, **kwargs)

Create a new APIExperiment, or use a previous experiment key to access an existing experiment.

Examples:

# Python API to create a new experiment:
# (assumes api keys are configured):
>>> experiment = APIExperiment(workspace=WORKSPACE,
  project_name=PROJECT)

# Python API to access an existing experiment:
# (assumes api keys are configured):
>>> experiment = APIExperiment(previous_experiment=EXPERIMENT_ID)

Note: rest_api_key may be defined in environment (COMET_REST_API_KEY)

or in a .comet.config file. Additional arguments will be given to API().


APIExperiment.add_tags

add_tags(self, tags)

Append onto an experiment's list of tags.

Args:

  • tags: a list of tags (strings)

Example:

>>> api_experiment.add_tags(["successful", "best"])

create_symlink(self, project_name)

Create a copy of this experiment in another project in the workspace.

Args:

  • project_name: the name of the project with which to create a symlink to this experiment in.

Example:

>>> api_experiment.create_symlink("my-other-project")

APIExperiment.display

display(self, clear=False, wait=True, new=0, autoraise=True, tab=None)

Show the Comet.ml experiment page in an IFrame in a Jupyter notebook or Jupyter lab, OR open a browser window or tab.

For Jupyter environments:

Args:

  • clear: to clear the output area, use clear=True
  • wait: to wait for the next displayed item, use wait=True (cuts down on flashing)

For non-Jupyter environments:

Args:

  • new: open a new browser window if new=1, otherwise re-use existing window/tab
  • autoraise: make the browser tab/window active

APIExperiment.download_model

download_model(self, name, output="./")

Download and save all files from the model.

Args:

  • name: str, the name of the model
  • output: str, the output directory

APIExperiment.end

end(self)

Method called at end of experiment.


APIExperiment.get_additional_system_info

get_additional_system_info(self)

Get the associated additional system info for this experiment.

Example:

>>> api_experiment.get_additional_system_info()
[]

APIExperiment.get_asset

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:

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

APIExperiment.get_asset_list

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:

>>> from comet_ml.api import API
>>> comet_api = API()
>>> x = comet_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

get_code(self)

Get the associated source code for this experiment.

Example:

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

APIExperiment.get_command

get_command(self)

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

Example:

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

APIExperiment.get_environment_details

get_environment_details(self)

Deprecated. Use APIExperiment.get_os_packages() instead.


APIExperiment.get_executable

get_executable(self)

Get the associated executable for this experiment.

Example:

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

APIExperiment.get_git_metadata

get_git_metadata(self)

Get the git-metadata associated with this experiment.

Example:

>>> api_experiment.get_git_metadata()
{
  "branch": 'refs/heads/master',
  "origin": 'git@github.com:comet-ml/comet-examples.git',
  "parent": '96ff529b4c02e4e0bb92992a7c4ce81275985764',
  "root": 'eec2d16daa057d0cf4c2c49974e6ea51e732a7b2',
  "user": 'user',
}

APIExperiment.get_git_patch

get_git_patch(self)

Get the git-patch associated with this experiment.

Example:

>>> api_experiment.get_git_patch()
...

APIExperiment.get_gpu_static_info

get_gpu_static_info(self)

Get the associated GPU static info for this experiment.

Example:

>>> api_experiment.get_gpu_static_info()
[{
  "gpuIndex": 0,
  "name": "GeForce GTX 950",
  "uuid": "GPU-cb6c1b39-5a56-6d79-8899-3796f23c6425",
  "totalMemory": 2090074112,
  "powerLimit": 110000,
}, ...]

APIExperiment.get_hostname

get_hostname(self)

Get the associated hostname for this experiment.

Example:

>>> api_experiment.get_hostname()
'name-of-computer-host'

APIExperiment.get_html

get_html(self)

Get the HTML associated with this experiment.

Example:

>>> api_experiment.get_html()
"<b>Hello, world!</b>"

APIExperiment.get_installed_packages

get_installed_packages(self)

Get the associated installed packages for this experiment.

Example:

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

APIExperiment.get_ip

get_ip(self)

Get the associated IP for this experiment.

Example:

>>> api_experiment.get_ip()
'175.29.200.91'

APIExperiment.get_max_memory

get_max_memory(self)

Get the associated max total memory for this experiment.

Example:

>>> api_experiment.get_max_memory()
1024

APIExperiment.get_metrics

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:

>>> from comet_ml.api import API
>>> comet_api = API()
>>> x = comet_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

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:

>>> from comet_ml.api import API
>>> comet_api = API()
>>> x = comet_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},
...]

>>> comet_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_data

get_model_data(self, name)

Get a model's data by name.

Args:

  • name: str, the name of the model

Returns: dictionary of model data with these fields:

'fileName', 'fileSize', 'link', 'createdAt', 'metadata'


APIExperiment.get_model_graph

get_model_graph(self)

Get the associated graph/model description for this experiment.

Example:

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

APIExperiment.get_model_names

get_model_names(self)

Get a list of model names associated with this experiment.

Returns: list of model names


APIExperiment.get_network_interface_ips

get_network_interface_ips(self)

Get the associated network interface IPs for this experiment.

Example:

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

APIExperiment.get_os

get_os(self)

Get the associated OS for this experiment.

Example:

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

APIExperiment.get_os_packages

get_os_packages(self)

Get the OS packages for this experiment.

Example:

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

APIExperiment.get_os_type

get_os_type(self)

Get the associated os type for this experiment.

Example:

>>> api_experiment.get_os_type()
'Linux'

APIExperiment.get_others_summary

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:

>>> from comet_ml.api import API
>>> comet_api = API()
>>> x = comet_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_output

get_output(self)

Get the associated standard output for this experiment.

Example:

>>> api_experiment.get_output()
"Experiment is live"

APIExperiment.get_parameters_summary

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:

>>> from comet_ml.api import API
>>> comet_api = API()
>>> x = comet_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

get_pid(self)

Get the pid for this experiment.

Example:

>>> api_experiment.get_pid()
34658

APIExperiment.get_python_version

get_python_version(self)

Get the Python version for this experiment.

Example:

>>> api_experiment.get_python_version()
'3.6.8'

APIExperiment.get_python_version_verbose

get_python_version_verbose(self)

Get the Python version verbose for this experiment.

Example:

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

APIExperiment.get_system_details

get_system_details(self)

Get the system details associated with this experiment.

Returns a dictionary like:

{
  "experimentKey": "someExperimentKey",
  "user": "system username"
  "pythonVersion": "python version"
  "pythonVersionVerbose": "python version with verbose flag"
  "pid": <Integer, pid>,
  "osType": "os experiment ran on",
  "os": "os with version info",
  "ip": "ip address",
  "hostname": "hostname",
  "gpuStaticInfoList": [
  {
  "gpuIndex": <Integer, index>,
  "name": "name",
  "uuid": "someUniqueId",
  "totalMemory": <Integer, total memory>,
  "powerLimit": <Integer, max power>
  }
  ],
  "logAdditionalSystemInfoList": [
  {
  "key": "someKey",
  "value": "someValue"
  }
  ],
  "systemMetricNames": ["name", "anotherName"],
  "maxTotalMemory": <double, max memory used>,
  "networkInterfaceIps": ["ip", "anotherIp"]
  "command": ["part1", "part2"],
  "executable": "The python Exe, if any (in future could be non python executables)",
  "osPackages": ["package", "anotherPackage"],
  "installedPackages": ["package", "anotherPackage"]
}

APIExperiment.get_system_metric_names

get_system_metric_names(self)

Get the associated system metric names for this experiment.

Example:

>>> api_experiment.get_system_metric_names()
['sys.cpu.percent.03', 'sys.cpu.percent.02', 'sys.cpu.percent.01', ...]

APIExperiment.get_tags

get_tags(self)

Get the associated tags for this experiment.

Example:

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

APIExperiment.get_total_memory

get_total_memory(self)

Get the associated total RAM for this experiment.

Example:

>>> api_experiment.get_total_memory()
1024

APIExperiment.get_user

get_user(self)

Get the associated user for this experiment.

Example:

>>> api_experiment.get_user()
'usename'

APIExperiment.log_additional_system_info

log_additional_system_info(self, key, value)

Log additional system information for this experiment.

Args:

  • key: (string) the name for this system information
  • value: (any type), the value of the system information

Example:

>>> experiment.log_additional_system_info("some name": 42)

APIExperiment.log_asset

log_asset(self, filename, step=None, overwrite=None, context=None, ftype=None, metadata=None)

Upload an asset to an experiment.

Args:

  • filename: the name of the asset file to upload
  • step: the current step
  • overwrite: if True, overwrite any previous upload
  • context: the current context (e.g., "train" or "test")
  • ftype: the type of asset (e.g., "image", "histogram_combined_3d", "image", "audio", or "video")
  • metadata: a JSON object to attach to image

Note: don't delete the file until upload is complete

Example:

>>> api_experiment.log_asset("histogram.json", ftype="histogram_compbined_3d")

APIExperiment.log_cpu_metrics

log_cpu_metrics(self, cpu_metrics, context=None, step=None, epoch=None, timestamp=None)

Log an instance of cpu_metrics.

Args:

  • cpu_metrics: a list of integer percentages, ordered by cpu
  • context: optional, a run context
  • step: optional, the current step
  • epoch: optional, the current epoch
  • timestamp: optional, current time, in milliseconds

Example:

# Four CPUs:
>>> api_experiment.log_cpu_metrics([25, 50, 10, 45])

APIExperiment.log_gpu_metrics

log_gpu_metrics(self, gpu_metrics)

Log an instance of gpu_metrics.

Args:

  • gpu_metrics: a list of dicts with keys:
  • gpuId: required, Int identifier
  • freeMemory: required, Long
  • usedMemory: required, Long
  • gpuUtilization: required, Int percentage utilization
  • totalMemory: required, Long

Example:

>>> api_experiment.log_gpu_metrics([{
...        "gpuId": 1,
...        "freeMemory": 1024,
...        "usedMemory": 856,
...        "gpuUtilization": 25,
...        "totalMemory": 2056,
... }])

APIExperiment.log_html

log_html(self, html, clear=False, timestamp=None)

Set, or append onto, an experiment's HTML.

Args:

  • html: (string) the HTML text to associate with this experiment
  • clear: (optional, boolean) if True, clear any previously logged HTML
  • timestamp: (optional, number) the current time (in milliseconds)

Example:

>>> api_experiment.log_html("<b>Hello!</b>")

APIExperiment.log_image

log_image(self, filename, image_name=None, step=None, overwrite=None, context=None)

Upload an image asset to an experiment.

Args:

  • filename: the name of the image file to upload
  • image_name: the name of the image
  • step: the current step
  • overwrite: if True, overwrite any previous upload
  • context: the current context (e.g., "train" or "test")

Note: don't delete the file until upload is complete

Example:

>>> api_experiment.log_image("image.png", "Weights")

APIExperiment.log_load_metrics

log_load_metrics(self, load_avg, context=None, step=None, epoch=None, timestamp=None)

Log an instance of system load metrics.

Args:

  • load_avg: required, the load average
  • context: optional, the run context
  • step: optional, the current step
  • epoch: optional, the current epoch
  • timestamp: optional, the current timestamp in milliseconds

Example:

>>> api_experiment.log_load_metrics(1.5, "validate", 100, 25, 65364346)

APIExperiment.log_metric

log_metric(self, metric, value, step=None, timestamp=None)

Set a metric name/value pair for an experiment.

Args:

  • metric: string, the name of the metric
  • value: any type, the value of the metric
  • step: optional integer, the current step
  • timestamp: optional, the current timestamp in milliseconds

Example:

>>> api_experiment.log_metric("loss", 0.698)

APIExperiment.log_other

log_other(self, key, value, timestamp=None)

Set an other key/value pair for an experiment.

Args:

  • key: string, the name of the other information
  • value: any time, the value of the other information
  • timestamp: optional, the current timestamp in milliseconds

Example:

>>> api_experiment.log_other("key", value)

APIExperiment.log_output

log_output(self, lines, context=None, stderr=False, timestamp=None)

Log output line(s).

Args:

  • lines: a list of strings representing standard output or error
  • context: optional, the run context
  • stderr: optional, boolean, if True, the lines are standard errors
  • timestamp: optional, the current timestamp in milliseconds

Example:

>>> api_experiment.log_output(["output line 1", "output line 2"])

APIExperiment.log_parameter

log_parameter(self, parameter, value, step=None, timestamp=None)

Set a parameter name/value pair for an experiment.

Args:

  • parameter: string, the name of the parameter
  • value: any type, the value of the parameter
  • step: optional integer, the current step
  • timestamp: optional, the current timestamp in milliseconds

Example:

>>> api_experiment.log_parameter("hidden_layer_size", 64)

APIExperiment.log_ram_metrics

log_ram_metrics(self, total_ram, used_ram, context=None, step=None, epoch=None, timestamp=None)

Log an instance of RAM metrics.

Args:

  • total_ram: required, total RAM available
  • used_ram: required, RAM used
  • context: optional, the run context
  • step: optional, the current step
  • epoch: optional, the current epoch
  • timestamp: optional, the current timestamp in millisconds

Example:

>>> api_experiment.log_ram_metrics(1024, 865, "train", 100, 1, 3645346534)

APIExperiment.set_code

set_code(self, code)

Set the code for this experiment.

Args:

  • code: string, the source code for this experiment

Example:

>>> api_experiment.set_code(source_code)

APIExperiment.set_command

set_command(self, command_args_list)

Set the command-line (script and args) for this experiment.

Args:

  • command_args_list: list of strings, starting with name of script, and followed by arguments.

Example:

>>> api_experiment.set_command(["script.py", "arg1", "arg2", "--flag", "arg3"])

APIExperiment.set_end_time

set_end_time(self, end_server_timestamp)

Set the end time of an experiment.

Args:

  • end_server_timestamp: a timestamp in milliseconds

Example:

>>> api_experiment.set_end_time(2652656352)

Note: Time is in milliseconds. If the start time has not

been set, it will be set to 1 second before the end time.


APIExperiment.set_executable

set_executable(self, executable)

Set the executable for this experiment.

Args:

  • executable: string, the python executable

Example:

>>> api_experiment.set_executable("/usr/bin/python3")

APIExperiment.set_git_metadata

set_git_metadata(self, user, root, branch, parent, origin)

Set the git metadata for this experiment.

Args:

  • user: (string, required) the name of the git user
  • root: (string, required) the name of the git root
  • branch: (string, required) the name of the git branch
  • parent: (string, required) the name of the git parent
  • origin: (string, required) the name of the git origin

Example:

>>> api_experiment.set_git_metadata("user", "root", "branch", "parent", "origin")

APIExperiment.set_git_patch

set_git_patch(self, file_data)

Set the git patch for this experiment.

Args:

  • file_data: the contents or filename of the git patch file

Example:

>>> api_experiment.log_git_patch("git.patch")

APIExperiment.set_gpu_static_info

set_gpu_static_info(self, gpu_static_info)

Set the GPU static info for this experiment.

Args:

  • gpu_static_info: list of dicts containing keys gpuIndex, name, uuid, totalMemory, and powerLimit and their values.

Example:

>>> api_experiment.set_gpu_static_info([{
  "gpuIndex": 0,
  "name": "GeForce GTX 950",
  "uuid": "GPU-cb6c1b39-5a56-6d79-8899-3796f23c6425",
  "totalMemory": 2090074112,
  "powerLimit": 110000,
}, ...])

APIExperiment.set_hostname

set_hostname(self, hostname)

Set the hostname for this experiment.

Args:

  • hostname: string, the hostname of the computer the experiment ran on

Example:

>>> api_experiment.set_hostname("machine.company.com")

APIExperiment.set_installed_packages

set_installed_packages(self, installed_packages)

Set the installed Python packages for this experiment.

Args:

  • installed_packages: list of strings, a list of the installed Python packages

Example:

>>> api_experiment.set_installed_packages(["comet_ml", "matplotlib"])

APIExperiment.set_ip

set_ip(self, ip)

Set the internet protocol (IP) address for this experiment.

Args:

  • user: string, the internet protocol address

Example:

>>> api_experiment.set_ip("10.0.0.7")

APIExperiment.set_model_graph

set_model_graph(self, graph)

Set the model graph for this experiment.

Args:

  • graph: various types, a representation of the model graph

Example:

>>> api_experiment.set_model_graph(model.to_json())

APIExperiment.set_name

set_name(self, name)

Set a name for the experiment. Useful for filtering and searching on Comet.ml. Will shown by default under the Other tab. Args:

  • name: String. A name for the experiment.

APIExperiment.set_network_interface_ips

set_network_interface_ips(self, network_interface_ips)

Set the network interface ips for this experiment.

Args:

  • network_interface_ips: list of strings, of local network interfaces

Example:

>>> api_experiment.set_network_interface_ips(["127.0.0.1", "192.168.1.100"])

APIExperiment.set_os

set_os(self, os)

Set the OS for this experiment.

Args:

  • user: string, the OS username

Example:

>>> api_experiment.set_os("Linux")

APIExperiment.set_os_packages

set_os_packages(self, os_packages)

Set the OS packages for this experiment.

Args:

  • os_packages: list of strings, the OS package list

Example:

>>> api_experiment.set_os_packages(['accountsservice=0.6.45-1ubuntu1', ...])

APIExperiment.set_os_type

set_os_type(self, os_type)

Set the OS type for this experiment.

Args:

  • os_type: string, the OS type

Example:

>>> api_experiment.set_os_type("Linux 2.0.1, Ubuntu 16.10")

APIExperiment.set_pid

set_pid(self, pid)

Set the process ID for this experiment.

Args:

  • pid: string, the OS process ID

Example:

>>> api_experiment.set_pid(54238)

APIExperiment.set_python_version

set_python_version(self, python_version)

Set the Python version for this experiment.

Args:

  • python_version: string, the verbose Python version

Example:

>>> api_experiment.set_python_version("3.6.7")

APIExperiment.set_python_version_verbose

set_python_version_verbose(self, python_version_verbose)

Set the Python version verbose for this experiment.

Args:

  • python_version_verbose: string, the verbose Python version

Example:

>>> api_experiment.set_python_version_verbose("3.6.7, by Anaconda")

APIExperiment.set_start_time

set_start_time(self, start_server_timestamp)

Set the start time of an experiment.

Args:

  • start_server_timestamp: a timestamp in milliseconds

Example:

>>> api_experiment.set_start_time(2652656352)

Note: Time is in milliseconds. If the end time has not been set

it will automatically be set for 1 second after the start time.


APIExperiment.set_user

set_user(self, user)

Set the user for this experiment.

Args:

  • user: string, the OS username

Example:

>>> api_experiment.set_user("os-user-name")

APIExperiment.to_json

to_json(self, full=False)

The experiment data in JSON-like format.

Args:

     - **full**:  bool (optional), if True, get all experiment information.

Examples:

>>> experiment.to_json()

Returns:

{'id': '073e272581ac48c283910a05e5495381',
'name': None,
'workspace': 'testuser',
'project_name': 'test-project-7515',
'archived': False,
'url': 'https://www.comet.ml/testuser/test-project-7515/073e272581ac48c283910a05e54953801',
'duration_millis': 4785,
'start_server_timestamp': 1571318652586,
'end_server_timestamp': 7437457,
'optimization_id': None,
}

```python
>>> experiment.to_json(full=True)

Returns:

{'id': '073e272581ac48c283910a05e5495380',
'name': None,
'workspace': 'testuser',
'project_name': 'test-project-7515',
'archived': False,
'url': 'https://staging.comet.ml/testuser/test-project-7515/073e272581ac48c283910a05e5495380',
'duration_millis': 4785,
'start_server_timestamp': 1571318652586,
'end_server_timestamp': 7437457,
'optimization_id': None,
'asset_list': [],
'code': 'one
two
three
',
'html': '<b>hello<b>
<i>world!</i>
',
'metrics': [],
'metrics_summary': [],
'output': 'four
five
six
',
'parameters_summary': [],
'system_details': {'experimentKey': None,
          'user': None,
          'pythonVersion': None,
          'pythonVersionVerbose': None,
          'pid': None,
          'osType': None,
          'os': None,
          'ip': None,
          'hostname': None,
          'gpuStaticInfoList': [],
          'logAdditionalSystemInfoList': [],
          'systemMetricNames': [],
          'maxTotalMemory': None,
          'networkInterfaceIps': None,
          'command': None,
          'executable': None,
          'osPackages': ['lib1', 'lib2', 'lib3'],
          'installedPackages': [],
          'totalRam': None},
'tags': ['tag6', 'tag7', 'tag8'],
'git_patch': b'',
'git_metadata': {'user': None, 'root': None, 'branch': None, 'parent': None, 'origin': None},
}

APIExperiment.update_status

update_status(self)

Update the status for this experiment. Sends the keep-alive status for it in the UI. The return JSON dictionary contains the recommended interval to send subsequent update_status() messages.

Example:

>>> api_experiment.update_status()
{'isAliveBeatDurationMillis': 10000,
'gpuMonitorIntervalMillis': 60000,
'cpuMonitorIntervalMillis': 68000}