LoginSignup
0
2

More than 3 years have passed since last update.

<python>プログラミング実行中の記録を残す→logging

Posted at

参考リンク

やりたいこと

機械学習モデルのパラメータやら、特徴量エンジニアリングの試行実験結果を、
excelによる手打ち記録から、自動ファイル出力へとステップアップする

この記事の対象者

  • python始めたばかり
  • モデルのパラメータを保存したい
  • 実験結果を残したい

コード

import logging # インポート

logger = logging.getLogger('aaa') # オブジェクト
logger.setLevel(logging.DEBUG) # 表示(出力)するlogレベルをdebugに変更する(デフォルトはwarning)

log_file = logging.FileHandler(filename='test.log', mode='w') # 出力するファイルを指定
logger.addHandler(log_file) 

logger.debug('debug')

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2