簡體   English   中英

fastai - plot 驗證和訓練准確度

[英]fastai - plot validation and training accuracy

我之前用過Keras,然后我用這種方式繪制了數據集的訓練和驗證准確率——

plt.plot(history.history['accuracy'])
plt.plot(history.history['val_accuracy'])

我目前正在學習 fastai,並且已經繪制了訓練和驗證損失。 但是我不知道 plot 驗證准確率和訓練准確率如何。

learn.recorder.plot_losses()

有人可以幫忙嗎?

查看: https://forums.fast.ai/t/plotting-metrics-after-learning/69937/3

那里詳細介紹了 Ignacio Oguiza 的 function plot_metrics()。 沒有它,你會得到一個錯誤'Learner' object has no attribute 'plot_metrics'

實施后,您可以調用 plot_metrics() 正如 Sirynka 提到的:

learn.recorder.plot_metrics()

你可能會得到一些漂亮的圖表: 在此處輸入圖像描述

此處僅適用於使用最新 FastAI 版本 2 的人。

上述方法已過時,適用於 Fast AI 版本 1。

對於最新版本,您應該使用帶有 fit 方法的回調:

learn.fit_one_cycle(10, slice(5e-3,5e-2),cbs=[ShowGraphCallback()])

這是文件

對 plot 訓練驗證指標使用這個新回調的好處是它直接在訓練和驗證的每個 epoch 之后發生,不需要單獨的代碼行。

learn.recorder.plot_metrics()

將 plot 您指定的所有指標

learn = cnn_learner(data, models.resnet34,
    metrics=[accuracy, error_rate])

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM