Python Getting Started

Getting started in Python: 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 hyperparameters. 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 hyperparameters, metrics and model configuration.

To make it easy, you can just put your personal Comet API key directly as a parameter to Experiment:

from comet_ml import Experiment
experiment = Experiment(YOUR-PERSONAL-API-KEY)

# Your code.

Or, even better, put your API key in a Comet config file and leave it out of your source code:

from comet_ml import Experiment
experiment = Experiment()

# Your code.

Automatic Logging

Comet can track many items automatically by merely creating an Experiment() object in your code. Here is a list of what is automatically tracked by framework:

Framework What is automatically logged
tensorflow steps and metrics
sklearn hyperparameters
keras graph description, steps, metrics, hyperparameters, optimizer config, and number of trainable parameters
mlflow hyperparameters, assets, models, plus lower-level framework items (e.g., tensorflow's metrics)
pytorch graph description, steps, and loss
fastai all pytorch items, plus epochs, and metrics
xgboost metrics, hyperparameters

For more details see Python SDK/Advanced.