Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

krippendorff_alpha reports 1.0 instead of NaN for single-rater identical ratings

クローズ 初心者向け
#2,843 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
86/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
analytics

調査の方向性

pyrit/score/scorer_evaluation/krippendorff.py から始めて krippendorff_alpha を調べ、特にカテゴリ数による早期リターンと、ペアにできる評価がない場合の既存の処理を確認します。まず、issue にある 2 つの NumPy の例を実行します。すべてのペアにできる評価がないデータセット(単一の評価者による同一の評価を含む)が NaN を返し、単一の評価者による異なる評価については既存の動作が引き続き正しい状態になれば完了です。

索引モデルが issue の本文から書いたものです。

説明

what happens

krippendorff_alpha returns 1.0 (perfect agreement) when every item is rated by a single rater and all those ratings happen to be identical. with no pairable ratings the statistic is undefined, so this should be NaN like it already is for single-rater data whose ratings differ.

the cause is ordering: the num_categories == 1 early return fires before the check that no item has two usable ratings, so identical-but-unpairable data takes the perfect-agreement exit.

repro

import numpy as np
from pyrit.score.scorer_evaluation.krippendorff import krippendorff_alpha

krippendorff_alpha(np.array([[1.0, 1.0]]))  # 1.0 — undefined statistic reported as perfect
krippendorff_alpha(np.array([[1.0, 2.0]]))  # nan — correct

same unpairable structure, opposite answers depending on whether the values coincide.

why it matters

this feeds the reliability metrics in scorer evaluation, and single-vote gold labels are a common input (cf #2628). reporting perfect agreement from one rater's identical votes overstates reliability.

expected

NaN for any dataset with no pairable ratings, per the docstring's own undefined-statistic rule.

env: main 5503ecb

主要言語
Python
スター
4.5k
フォーク
896
平均マージ
2日 22時間
マージ済み PR(30日)
230

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/PyRIT のほかの issue

microsoft/PyRIT の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。