Getting started: 30 seconds to Comet.ml

The core class of Comet.ml is an Experiment, a specific run of a script that generated a result such as training a model on a single set of hyper parameters. An Experiment. will automatically log scripts output (stdout/stderr), code, and command line arguments on any script and for the supported libraries will also log hyper parameters, metrics and model configuration.

Here is the Experiment object:

from comet_ml import Experiment
experiment = Experiment(api_key="YOUR_API_KEY")

# Your code.

You can also set the API_KEY as an environment variable COMET_API_KEY then instantiate your experiment like this:

from comet_ml import Experiment
experiment = Experiment()

# Your code.

The Experiment object logs various parameters of your experiment to Comet.ml

from comet_ml import Experiment
experiment = Experiment(api_key="YOUR_API_KEY")
batch_size = 4 # A hyperparameter used somewhere in the code.

experiment.log_parameter("batch_size", batch_size) 

By default your experiment will be added to the project Uncategorized Experiments. You can also log your experiment to a specific project.

from comet_ml import Experiment

#if "my project name" does not already exist, it will be created.
experiment = Experiment(api_key="YOUR_API_KEY",
                        project_name="my project name")
batch_size = 4 

experiment.log_parameter("batch_size", batch_size) 

You can also log a custom list of hyperparameters to your experiment via a dictionary.

from comet_ml import Experiment
experiment = Experiment(api_key="YOUR_API_KEY",
                        project_name="my project name",
                        auto_param_logging=False)
batch_size = 128
num_classes = 10
epochs = 20

params={
    "batch_size":batch_size,
    "epochs":epochs,
    "num_classes":num_classes}

experiment.log_parameters(params)

We all strive to be data driven and yet every day valuable experiments results are just lost and forgotten. Comet.ml provides a dead simple way of fixing that. Works with any workflow, any ML task, any machine and any piece of code.

For a more in-depth tutorial about Comet.ml, you can check out:


Installation

pip install comet_ml

Comet.ml python SDK is compatible with: Python 2.7-3.6.

Checking Comet.ml version

pip show comet_ml