๐Ÿ“Š ๋‹ค์–‘ํ•œ ์‹œ๊ฐํ™” ๋ฐฉ๋ฒ•

๋Œ€ํ‘œ์ ์œผ๋กœ WandB๋Š” ํ•™์Šตlog ์‹œ๊ฐํ™”๋ฅผ ์ฃผ๋กœ ์‚ฌ์šฉํ•œ๋‹ค.

๋Œ€ํ‘œ์ ์œผ๋กœ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

  • Loss, Accuracy ๊ทธ๋ž˜ํ”„
  • Model parameter(gradient) ๊ทธ๋ž˜ํ”„
  • pred_img ์‹œ๊ฐํ™”
  • sweep ๊ทธ๋ž˜ํ”„
  • Confusion Matrix
  • ROC, PR Curve

 

 

 

 

1.  Loss, Accuracy ๊ทธ๋ž˜ํ”„

๐Ÿ’ป ์ฝ”๋“œ

wandb.log({'loss':loss}, step=epoch)
wandb.log({'val_loss': val_loss,
           'val_acc': val_accuracy })

 

๐Ÿ“Š ์‹œ๊ฐํ™”


 

 

2.  Model parameter(gradient) ๊ทธ๋ž˜ํ”„

๐Ÿ’ป ์ฝ”๋“œ

wandb.watch(model, criterion, log="all", log_freq=10)

log="all"์„ ์ฃผ๋ฉด gradient์™€ parameter, bias๋ฅผ ๋ชจ๋‘ ๊ธฐ๋กํ•  ์ˆ˜ ์žˆ๋‹ค.

 

๐Ÿ“Š ์‹œ๊ฐํ™”

 

 


3.  Pred_Img ์‹œ๊ฐํ™”

๐Ÿ’ป ์ฝ”๋“œ

ex_images.append(wandb.Image(data[0], 
                                  caption="Pred:{} Truth:{}".format(pred[0].item(), target[0])
                                  ))
  
 wandb.log({"Image": ex_images})

 

๐Ÿ“Š ์‹œ๊ฐํ™”

cf) index๋ฐ”๋ฅผ ์กฐ์ ˆํ•ด ํ•™์Šต์ง„ํ–‰๊ฒฝ๊ณผํ™•์ธ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

 


4.  sweep ๊ทธ๋ž˜ํ”„

๐Ÿ’ป ์ฝ”๋“œ

sweep_id = wandb.sweep(sweep_config, project="mnist", entity='v2llain')
wandb.agent(sweep_id, run_sweeep, count=6)

 

๐Ÿ“Š ์‹œ๊ฐํ™”

X์ถ•: configuration๋œ parameter์ด๋ฆ„

y์ถ•: ๋ณ€๊ฒฝ๋œ ๊ฐ’

๋งจ ์šฐ์ธก: ์„ฑ๋Šฅ์ธก์ •๊ฐ’

 


5.  Confusion Matrix

๐Ÿ’ป ์ฝ”๋“œ

sweep์‹คํ–‰โŒ)

wandb.sklearn.plot_confusion_matrix(y_test, y_pred, 
                                    labels=classes_name)

 

sweep์‹คํ–‰โญ•๏ธ)

wandb.log({
      "Confusion Matrix":
      wandb.plot.confusion_matrix(preds=best_all_preds,
                                  y_true=best_all_labels,
                                  class_names=classes_name
                                  )})

 

๐Ÿ“Š ์‹œ๊ฐํ™”

์ขŒ) sweep X.   ์šฐ) sweep์ง„ํ–‰ ์‹œ, ์ƒ‰๋ณ„๋กœ sweep๊ตฌ๋ถ„๊ฐ€๋Šฅ.

 


6. ROC, PR Curve

๐Ÿ’ป ์ฝ”๋“œ

wandb.log({'roc': wandb.plots.ROC(y_test, y_prob_pred, cnb.classes_)})
wandb.log({'pr': wandb.plots.precision_recall(y_test, y_prob_pred, cnb.classes_)})

 

๐Ÿ“Š ์‹œ๊ฐํ™”

๋‘ ๊ทธ๋ž˜ํ”„ ๋ชจ๋‘ ์ƒ๋‹จ์— ์œ„์น˜ํ• ์ˆ˜๋ก ์ข‹์€ ๊ทธ๋ž˜ํ”„ (โˆตAUC๊ฐ€ ํด์ˆ˜๋ก ์ข‹๊ธฐ ๋•Œ๋ฌธ.)

 

 

'Deep Learning : Vision System > Pytorch & MLOps' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[๐Ÿ”ฅPyTorch 2.2]: transformv2 , torch.compile  (0) 2024.01.31
[WandB] Step 2. WandB Sweeps  (2) 2024.01.09
[WandB] Step 1. WandB Experiments. with MNIST  (2) 2024.01.09

+ Recent posts