ExistingExperiment

ExistingExperiment

Existing Experiment allows you to report information to an experiment that already exists on comet.ml and is not currently running. This is useful when your training and testing happen on different scripts.

For example:

train.py: exp = Experiment(api_key="my-key") score = train_model() exp.log_metric("train accuracy", score)

Now obtain the experiment key from comet.ml. If it's not visible on your experiment table you can click Customize and add it as a column.

test.py: exp = ExistingExperiment(api_key="my-key", previous_experiment="your experiment key from comet.ml") score = test_model() exp.log_metric("test accuracy", score)

Alternatively, you can pass the api_key via an environment variable named COMET_API_KEY and the previous experiment id via an environment variable named COMET_EXPERIMENT_KEY and omit them from the ExistingExperiment constructor:

exp = ExistingExperiment() score = test_model() exp.log_metric("test accuracy", score)

ExistingExperiment.url

Get the url of the experiment.

Example:

```python

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


ExistingExperiment.__init__

python __init__(self, api_key=None, previous_experiment=None, **kwargs)

Continues an Comet.ml experiment.

Uses the same arguments and keywords as Experiment, and the following:

Args:

  • previous_experiment: Your experiment key from comet.ml

Note: ExistingExperiment does not alter nor destroy previously logged information. To override or add to previous information you will have to set the appropriate following parameters to True:

  • log_code
  • log_graph
  • parse_args
  • log_env_details
  • log_git_metadata
  • log_git_patch
  • log_env_gpu
  • log_env_cpu
  • log_env_host

For example, to contiue to collect GPU information in an ExistingExperiment you will need to override these parameters:

```python

experiment = ExistingExperiment( ... log_env_details=True, ... log_env_gpu=True) ```

You can also set the previous_experiment via COMET_EXPERIMENT_KEY in the Comet Config Variables.

See also: