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:
```python 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:
```python from comet_ml import Experiment experiment = Experiment()
Your code.¶
```
Automatic Logging¶
When you add the above two lines in your code, you will automatically get the following items logged:
- script, or Jupyter Notebook
- git metadata and patch
- model graph representation (see below)
- model weights and biases (see below)
- model hyperparameters (see below)
- training metrics (see below)
- command-line arguments to script
- console and Jupyter Notebook standard output and error
- environment GPU, CPU, hostname, and more
If you are using the following frameworks, then you will log:
Framework | What is automatically logged |
---|---|
tensorflow | steps and metrics; see examples |
tensorflow model analysis | time series, plots, and slicing metrics |
tensorboard | summary scalars (as metrics) and summary histograms |
sklearn | hyperparameters; see examples |
keras | graph description, steps, metrics, hyperparameters, weights and biases as histograms, optimizer config, and number of trainable parameters; see examples |
mlflow | hyperparameters, assets, models, plus lower-level framework items (e.g., tensorflow's metrics, tensorboard summaries) |
fbprophet | hyperparameters, model, and figures |
pytorch | graph description, steps, and loss; see examples |
pytorch-lightning | loss and accuracy, with refinements in progress; see examples |
pytorch + apex | loss; see examples |
fastai | all pytorch items, plus epochs, and metrics; see examples |
xgboost | metrics, hyperparameters; see examples |
Info
Also check out the comet init
command-line method of creating best-practices code with Comet.
For more details see Python SDK/Advanced.