Experiment | R Documentation |
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.
LoggedArtifact
with all relevant information about logged
artifact.
LoggedArtifact
with all relevant information about logged
artifact.
new()
Do not call this function directly. Use create_experiment()
or get_experiment()
instead.
Experiment$new( experiment_key, experiment_url = NULL, api_key = NULL, keep_active = FALSE, log_output = FALSE, log_error = FALSE, dynamic = TRUE, workspace_name = NULL, project_name = NULL )
experiment_key
The key of the Experiment
.
experiment_url
The URL of the Experiment
.
api_key
Comet API key (can also be specified using the COMET_API_KEY
parameter as an environment variable or in a comet config file).
keep_active
If TRUE
, automatically send Comet a status update every
few seconds until the experiment is stopped to mark the experiment as active on the
Comet web dashboard.
log_output
If TRUE
, all standard output will automatically be sent to
the Comet servers to display as message logs for the experiment. The output will still
be shown in the console as well.
log_error
If TRUE
, all output from 'stderr' (which includes errors,
warnings, and messages) will be redirected to the Comet servers to display as message
logs for the experiment. Note that unlike auto_log_output
, if this option is on then
these messages will not be shown in the console and instead they will only be logged
to the Comet experiment. This option is set to FALSE
by default because of this
behavior.
dynamic
If TRUE
the Experiment was created rather than retrieved.
workspace_name
The workspace name (can also be specified using the COMET_WORKSPACE
parameter as an environment variable or in a comet config file).
project_name
The project name (can also be specified using the COMET_PROJECT_NAME
parameter as an environment variable or in a comet config file).
get_key()
Get the experiment key of an experiment.
Experiment$get_key()
get_workspace_name()
Get the workspace name of an experiment.
Experiment$get_workspace_name()
get_project_name()
Get the project name of an experiment.
Experiment$get_project_name()
get_dynamic()
Get the dynamic status of an experiment.
Experiment$get_dynamic()
get_url()
Get the URL to view an experiment in the browser.
Experiment$get_url()
get_metadata()
Get an experiment's metadata.
Experiment$get_metadata()
archive()
Archive an experiment.
Experiment$archive()
restore()
Restore an archived experiment.
Experiment$restore()
delete()
Delete an experiment.
Experiment$delete()
stop()
Stop an experiment. Always call this method before creating a new experiment.
Experiment$stop()
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.
Experiment$log_metric(name, value, step = NULL, epoch = NULL, context = NULL)
name
(Required) Name of the metric.
value
(Required) Value of the metric.
step
Step number.
epoch
Epoch.
context
Context.
get_metric()
Get All Metrics For Name
Experiment$get_metric(name)
name
(Required) Name of metric.
get_metrics_summary()
Get an experiment's metrics summary.
Experiment$get_metrics_summary()
log_graph()
Log an experiment's associated model graph.
Experiment$log_graph(graph)
graph
(Required) JSON representation of a graph.
get_graph()
Get an experiment's model graph.
Experiment$get_graph()
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).
Experiment$log_parameter(name, value, step = NULL)
name
(Required) Name of the parameter.
value
(Required) Value of the parameter.
step
Step number.
get_parameters()
Get an experiment's parameters summary.
Experiment$get_parameters()
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).
Experiment$log_other(key, value)
key
(Required) The key.
value
(Required) The value.
get_other()
Get an experiment's others (logged with log_other()
) summary.
Experiment$get_other()
add_tags()
Add a list of tags to an experiment.
Experiment$add_tags(tags)
tags
(Required) List of tags.
get_tags()
Get an experiment's tags.
Experiment$get_tags()
log_html()
Set (or append onto) an experiment's HTML.
Experiment$log_html(html, override = FALSE)
html
(Required) An HTML string to add to the experiment.
override
If TRUE
, override the previous HTML. If FALSE
, append to it.
get_html()
Get an experiment's HTML.
Experiment$get_html()
upload_asset()
Upload a file to the experiment.
Experiment$upload_asset( file, step = NULL, overwrite = NULL, context = NULL, type = NULL, name = NULL, metadata = NULL )
file
(Required) Path to the file to upload.
step
Step number.
overwrite
If TRUE
, 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.
log_remote_asset()
Logs a Remote Asset identified by an URI. A Remote Asset is an asset but its content is not uploaded and stored on Comet. Rather a link for its location is stored, so you can identify and distinguish between two experiment using different version of a dataset stored somewhere else.
Experiment$log_remote_asset( uri, remote_file_name = NULL, step = NULL, overwrite = FALSE, type = "asset", metadata = NULL )
uri
(Required) The remote asset location, there is no imposed format, and it could be a private link.
remote_file_name
The "name" of the remote asset, could be a dataset name, a model file name.
step
Step number.
overwrite
If TRUE
, overwrite any logged asset with the same name.
type
The type of asset, default: "asset".
metadata
Metadata to log along with the asset
get_asset_list()
Get an experiment's asset list.
Experiment$get_asset_list(type = NULL)
type
The type of assets to retrieve (by default, all assets are returned).
get_asset()
Get an asset.
Experiment$get_asset(assetId)
assetId
(Required) The asset ID to retrieve.
create_symlink()
Add a symlink to an experiment in another project.
Experiment$create_symlink(project_name)
project_name
(Required) Project that the experiment to should linked to.
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.
Experiment$log_git_metadata( branch = NULL, origin = NULL, parent = NULL, user = NULL, root = NULL )
branch
Git branch name.
origin
Git repository origin.
parent
Git commit SHA.
user
Git username.
root
Git root.
get_git_metadata()
Get the git metadata of an experiment.
Experiment$get_git_metadata()
get_git_patch()
Get the git patch of an experiment.
Experiment$get_git_patch()
get_output()
Get an experiment's standard output and error.
Experiment$get_output()
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.
Experiment$log_code(code)
code
The code to set as the source code.
get_code()
Get an experiment's source code.
Experiment$get_code()
log_system_details()
Log system details. This can be done automatically by enabling log_system_details
in create_experiment()
or get_experiment()
.
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 )
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 a list()
with
fields gpuIndex
, 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 a list()
with key
and value
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.
get_system_details()
Get an experiment's system details.
Experiment$get_system_details()
log_artifact()
Log an Artifact
object, synchronously create a new Artifact Version and
upload all local and remote assets attached to the Artifact
object.
Experiment$log_artifact(artifact)
artifact
an Artifact
object.
get_artifact()
Returns a logged artifact object that can be used to access the artifact version assets and download them locally.
If no version or alias is provided, the latest version for that artifact is returned.
Experiment$get_artifact( artifact_name, workspace = NULL, version_or_alias = NULL )
artifact_name
(Required) Retrieve an artifact with that name. This could either be a fully
qualified artifact name like workspace/artifact-name:versionOrAlias
or just the name
of the artifact like artifact-name
.
workspace
Retrieve an artifact belonging to that workspace.
version_or_alias
Retrieve the artifact by the given alias or version.
\dontrun{ library(cometr) # Assuming you have COMET_API_KEY, COMET_WORKSPACE, COMET_PROJECT_NAME variables define exp <- create_experiment() # Get a Comet Artifact logged_artifact <- exp$get_artifact("workspace/artifact-name:version_or_alias") # Which is equivalent to logged_artifact = exp$get_artifact(artifact_name="artifact-name", workspace="workspace", version_or_alias="version_or_alias") }
set_start_end_time()
Set an experiment's start and end time.
Experiment$set_start_end_time(start = NULL, end = NULL)
start
Start time for the experiment (milliseconds since the Epoch)
end
End time for the experiment (milliseconds since the Epoch)
print()
Print the experiment.
Experiment$print()
## Not run:
library(cometr)
# Assuming you have COMET_API_KEY, COMET_WORKSPACE, COMET_PROJECT_NAME variables define
exp <- create_experiment()
exp$get_key()
exp$get_metadata()
exp$add_tags(c("test", "tag2"))
exp$get_tags()
exp$log_metric("metric1", 5)
exp$get_metric("metric1")
exp$get_metrics_summary()
exp$stop()
## End(Not run)
## ------------------------------------------------
## Method `Experiment$get_artifact`
## ------------------------------------------------
## Not run:
library(cometr)
# Assuming you have COMET_API_KEY, COMET_WORKSPACE, COMET_PROJECT_NAME variables define
exp <- create_experiment()
# Get a Comet Artifact
logged_artifact <- exp$get_artifact("workspace/artifact-name:version_or_alias")
# Which is equivalent to
logged_artifact = exp$get_artifact(artifact_name="artifact-name",
workspace="workspace",
version_or_alias="version_or_alias")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.