アプリ版:「スタンプのみでお礼する」機能のリリースについて

下記のコードで、『experiment = Experiment(project_name="matplotlib")』で
下記のエラーがでます。
Q1)正しいコードをお教え頂けますと大変有難いです。

import matplotlib as mpl
mpl.use('TkAgg')
# mpl.use('Agg') if you are on a headless machine
import matplotlib.pyplot as plt
import numpy as np
from comet_ml import Experiment
experiment = Experiment(project_name="matplotlib")
#Traceback (most recent call last): <--このエラーです。
# File "C:\WK_newPrg\WK_python\plotAAA.py", line 10, in <module>
# experiment = Experiment(project_name="matplotlib")
# File #"C:\Users\mrshi\AppData\Local\Programs\Python\Python39\lib\site-packages\comet_ml\__init__.py", line 261, in __init__
# raise ValueError(
#ValueError: Comet.ml requires an API key. Please provide as the first argument to Experiment(api_key) or as an environment variable named COMET_API_KEY
#
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s)
plt.xlabel('time (s)')
plt.ylabel('voltage (mV)')
plt.title('About as simple as it gets, folks')
plt.grid(True)
experiment.log_figure(figure=plt)

以上、宜しくお願いします。

A 回答 (1件)

エラーコメントとネット検索した結果からするとcomet_mlを使うにはapi_keyが必要で、これをExperimentの第一引数で渡すか、環境変数COMET_API_KEYにセットしておく必要がある。


api_keyはcomet_mlのアカウントを作って取得するようだ。
# https://qiita.com/29Takuya/items/00c1f4fef5983cd …
    • good
    • 0
この回答へのお礼

お世話になります。
回答有難う御座いました。

お礼日時:2021/11/27 12:54

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!