LoginSignup
1
0

More than 3 years have passed since last update.

ValueError: Only one class present in y_true. ROC AUC score is not defined in that case.

Posted at

手っ取り早い解決方法

以下のようにdrop_lastをTrueで設定してあげましょう。


train_loader = torch.utils.data.DataLoader(
        train_dataset,
        batch_size=batch_size,
        shuffle=True,
        num_workers=workers,
        pin_memory=True,
        drop_last=True,
        sampler=None)

<参考>

このエラーの原因はラストのミニバッチの画像クラスがどちらか一方しかないことです。(下により詳しく載ってます)

ROC,AUCについてはここに詳しく載ってます。

1
0
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
1
0