Skip to content

Commit 7388076

Browse files
committed
Update training example.
1 parent 14564ca commit 7388076

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

comet/comet_callback.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,16 @@
2828
from sklearn.model_selection import train_test_split
2929

3030

31-
experiment = comet_ml.Experiment(api_key=os.getenv("COMET_API_KEY"))
32-
comet_ml.login(project_name="comet-optuna-example")
31+
# Ensure the API key is available
32+
if not os.getenv("COMET_API_KEY"):
33+
raise ValueError("COMET_API_KEY is missing! Please set it as an environment variable.")
34+
35+
# Start the experiment using comet_ml.start()
3336
experiment = comet_ml.start()
3437

38+
# Log the project name
39+
experiment.set_name("comet-optuna-example")
40+
3541
# Load dataset
3642
random_state = 42
3743
cancer = load_breast_cancer()

0 commit comments

Comments
 (0)