Experiment: A Comet Experiment object¶
Description¶
A comet experiment object can be used to modify or get information about an active
experiment. All methods documented here are the different ways to interact with an
experiment. Use create_experiment()
to create or get_experiment()
to
retrieve a Comet experiment object.
Examples¶
```r library(cometr)
Assuming you have COMET_API_KEY, COMET_WORKSPACE, COMET_PROJECT_NAME variables define¶
exp <- create_experiment() expget_key() expget_metadata() expadd_tags(c("test", "tag2")) expget_tags() explog_metric("metric1", 5) expget_metric("metric1") expget_metrics_summary() expstop() ```
Methods¶
Public methods¶
Experiment$new()
Experiment$get_key()
Experiment$get_dynamic()
Experiment$get_url()
Experiment$get_metadata()
Experiment$archive()
Experiment$restore()
Experiment$delete()
Experiment$stop()
Experiment$log_metric()
Experiment$get_metric()
Experiment$get_metrics_summary()
Experiment$log_graph()
Experiment$get_graph()
Experiment$log_parameter()
Experiment$get_parameters()
Experiment$log_other()
Experiment$get_other()
Experiment$add_tags()
Experiment$get_tags()
Experiment$log_html()
Experiment$get_html()
Experiment$upload_asset()
Experiment$get_asset_list()
Experiment$get_asset()
Experiment$create_symlink()
Experiment$log_git_metadata()
Experiment$get_git_metadata()
Experiment$get_git_patch()
Experiment$get_output()
Experiment$log_code()
Experiment$get_code()
Experiment$log_system_details()
Experiment$get_system_details()
Experiment$set_start_end_time()
Experiment$print()
Method new()
¶
Do not call this function directly. Use create_experiment()
or get_experiment()
instead.
Usage:
r
Experiment$new(
experiment_key,
experiment_url = NULL,
api_key = NULL,
keep_active = FALSE,
log_output = FALSE,
log_error = FALSE,
dynamic = TRUE
)
Method get_key()¶
Get the experiment key of an experiment.
Usage:
r
Experiment$get_key()
Method get_dynamic()¶
Get the dynamic status of an experiment.
Usage:
r
Experiment$get_dynamic()
Method get_url()¶
Get the URL to view an experiment in the browser.
Usage:
r
Experiment$get_url()
Method get_metadata()¶
Get an experiment's metadata.
Usage:
r
Experiment$get_metadata()
Method archive()¶
Archive an experiment.
Usage:
r
Experiment$archive()
Method restore()¶
Restore an archived experiment.
Usage:
r
Experiment$restore()
Method delete()¶
Delete an experiment.
Usage:
r
Experiment$delete()
Method stop()¶
Stop an experiment. Always call this method before creating a new experiment.
Usage:
r
Experiment$stop()
Method log_metric()¶
Log a metric name and value. Metrics are the only items that are logged as a full time series. However, even metrics can be throttled if too much data (either by rate or by count) is attempted to be logged.
Usage:
r
Experiment$log_metric(name, value, step = NULL, epoch = NULL, context = NULL)
Arguments:
name
(Required) Name of the metric.value
(Required) Value of the metric.step
Step number.epoch
Epoch.context
Context.
Method get_metric()¶
Get All Metrics For Name
Usage:
r
Experiment$get_metric(name)
Arguments:
name
(Required) Name of metric.
Method get_metrics_summary()¶
Get an experiment's metrics summary.
Usage:
r
Experiment$get_metrics_summary()
Method log_graph()¶
Log an experiment's associated model graph.
Usage:
r
Experiment$log_graph(graph)
Arguments:
graph
(Required) JSON representation of a graph.
Method get_graph()¶
Get an experiment's model graph.
Usage:
r
Experiment$get_graph()
Method log_parameter()¶
Log a parameter name and value. Note that you can only retrieve parameters summary data (e.g., this is not recorded as a full time series).
Usage:
r
Experiment$log_parameter(name, value, step = NULL)
Arguments:
name
(Required) Name of the parameter.value
(Required) Value of the parameter.step
Step number.
Method get_parameters()¶
Get an experiment's parameters summary.
Usage:
r
Experiment$get_parameters()
Method log_other()¶
Log a key/value `other`` data (not a metric or parameter). Note that you can only retrieve others summary data (e.g., this is not recorded as a full time series).
Usage:
r
Experiment$log_other(key, value)
Arguments:
key
(Required) The key.value
(Required) The value.
Method get_other()¶
Get an experiment's others (logged with log_other()
) summary.
Usage:
r
Experiment$get_other()
Method add_tags()¶
Add a list of tags to an experiment.
Usage:
r
Experiment$add_tags(tags)
Arguments:
tags
(Required) List of tags.
Method get_tags()¶
Get an experiment's tags.
Usage:
r
Experiment$get_tags()
Method log_html()¶
Set (or append onto) an experiment's HTML.
Usage:
r
Experiment$log_html(html, override = FALSE)
Arguments:
html
(Required) An HTML string to add to the experiment.override
IfTRUE
, override the previous HTML. IfFALSE
, append to it.
Method get_html()¶
Get an experiment's HTML.
Usage:
r
Experiment$get_html()
Method upload_asset()¶
Upload a file to the experiment.
Usage:
r
Experiment$upload_asset(
file,
step = NULL,
overwrite = NULL,
context = NULL,
type = NULL,
name = NULL,
metadata = NULL
)
Arguments:
file
(Required) Path to the file to upload.step
Step number.overwrite
IfTRUE
, overwrite any uploaded file with the same name.context
The context.type
The type of asset.name
Name of the file on comet. By default the name of the file will match the file that you upload, but you can use this parameter to use a different name.metadata
Metadata to upload along with the file.
Method get_asset_list()¶
Get an experiment's asset list.
Usage:
r
Experiment$get_asset_list(type = NULL)
Arguments:
type
The type of assets to retrieve (by default, all assets are returned).
Method get_asset()¶
Get an asset.
Usage:
r
Experiment$get_asset(assetId)
Arguments:
assetId
(Required) The asset ID to retrieve.
Method create_symlink()¶
Add a symlink to an experiment in another project.
Usage:
r
Experiment$create_symlink(project_name)
Arguments:
project_name
(Required) Project that the experiment to should linked to.
Method log_git_metadata()¶
Log an experiment's git metadata. This should only be called once and it can be done
automatically by enabling log_git_info
in create_experiment()
or get_experiment()
This will replace any previous git metadata that was logged.
Usage:
r
Experiment$log_git_metadata(
branch = NULL,
origin = NULL,
parent = NULL,
user = NULL,
root = NULL
)
Arguments:
branch
Git branch name.origin
Git repository origin.parent
Git commit SHA.user
Git username.root
Git root.
Method get_git_metadata()¶
Get the git metadata of an experiment.
Usage:
r
Experiment$get_git_metadata()
Method get_git_patch()¶
Get the git patch of an experiment.
Usage:
r
Experiment$get_git_patch()
Method get_output()¶
Get an experiment's standard output and error.
Usage:
r
Experiment$get_output()
Method log_code()¶
Log an experiment's source code. This should only be called once and it can be done
automatically by enabling log_code
in create_experiment()
or get_experiment()
.
This will replace any previous code that was logged.
Usage:
r
Experiment$log_code(code)
Arguments:
code
The code to set as the source code.
Method get_code()¶
Get an experiment's source code.
Usage:
r
Experiment$get_code()
Method log_system_details()¶
Log system details. This can be done automatically by enabling log_system_details
in create_experiment()
or get_experiment()
.
Usage:
r
Experiment$log_system_details(
command = NULL,
executable = NULL,
hostname = NULL,
installed_packages = NULL,
gpu_static_info = NULL,
ip = NULL,
network_interface_ips = NULL,
additional_system_info = NULL,
os = NULL,
os_packages = NULL,
os_type = NULL,
pid = NULL,
user = NULL,
r_version = NULL,
r_version_verbose = NULL
)
Arguments:
command
Script and optional arguments.executable
Executable.hostname
Hostname.installed_packages
List of installed R packages.gpu_static_info
List of GPU information, where each GPU is alist()
with fieldsgpuIndex
,name
,powerLimit
,totalMemory
,uuid
.ip
IP address.network_interface_ips
List of network interface IPs.additional_system_info
List of additional parameters to log, where each parameter is alist()
withkey
andvalue
pairs.os
Full details about operating system.os_packages
List of operating system packages installed.os_type
Operating system type.pid
Process ID.user
User.r_version
Short form R version.r_version_verbose
Long form R version.
Method get_system_details()¶
Get an experiment's system details.
Usage:
r
Experiment$get_system_details()
Method set_start_end_time()¶
Set an experiment's start and end time.
Usage:
r
Experiment$set_start_end_time(start = NULL, end = NULL)
Arguments:
start
Start time for the experiment (milliseconds since the Epoch)end
End time for the experiment (milliseconds since the Epoch)
Method print()¶
Print the experiment.
Usage:
r
Experiment$print()