跳至內容
Astera Technology

量度兩位同事的評分一致程度

完整列兩位同事判斷的四格表,保留一致比例及分歧編號。

下載完整個案資料及參考答案 ↓

訂明本例驗收任務

兩位假設同事每個不同且非全空白文字編號各提供一筆布林判斷,編號原樣比較。欠文字編號或重複行便先暫停,不進分母計數;空批次仍可作空觀察清單。完整列二乘二表:同通過、同失敗、只 A 通過、只 B 通過,再列一致分子及個案分母。此例不解決分歧,一致也不代表標籤一定正確。

  1. 核每題兩位同事標籤
  2. 填四格一致表
  3. 分歧編號另留覆核

欠標籤是資料缺口,不自動算分歧或一致。

使用已填個案

原創假設輸入及確切答案鍵
個案已提供輸入預期結構化結果判斷及原因
四題一致表{"rows":[{"id":"1","a":true,"b":true},{"id":"2","a":true,"b":true},{"id":"3","a":false,"b":false},{"id":"4","a":true,"b":false}]}{"matrix":{"bothPass":2,"bothFail":1,"aOnly":1,"bOnly":0},"agreement":3,"total":4,"disagreements":["4"]}四題有三題一致,4 保留分歧。
兩個方向都有分歧{"rows":[{"id":"A","a":true,"b":false},{"id":"B","a":false,"b":true}]}{"matrix":{"bothPass":0,"bothFail":0,"aOnly":1,"bOnly":1},"agreement":0,"total":2,"disagreements":["A","B"]}通過總數相同,卻是相反個案判斷。
清單同題出現兩次{"rows":[{"id":"A","a":true,"b":false},{"id":"A","a":false,"b":true}]}{"error":"review-case-identity"}A 兩行不能算兩個不同個案,也不能藏起互相矛盾判斷。
字串不是布林{"rows":[{"id":"A","a":"pass","b":true}]}{"error":"review-label"}要求布林標籤,不靜默轉字串。
下載可編輯 CSV ↓

逐步處理 invalid-label 個案,須得到甚麼結果?原因是甚麼?

查看參考答案

{"error":"review-label"}。要求布林標籤,不靜默轉字串。

執行完整本機驗算

另存為 .mjs,以 Node.js 執行;只驗提供的個案
import assert from 'node:assert/strict';

function evaluate(x){
 if(x.rows.some(r=>typeof r.id!=='string'||!r.id.trim())||new Set(x.rows.map(r=>r.id)).size!==x.rows.length)return {error:'review-case-identity'};
 if(x.rows.some(r=>typeof r.a!=='boolean'||typeof r.b!=='boolean'))return {error:'review-label'};
 const matrix={bothPass:0,bothFail:0,aOnly:0,bOnly:0},disagreements=[];for(const r of x.rows){const key=r.a?(r.b?'bothPass':'aOnly'):(r.b?'bOnly':'bothFail');matrix[key]++;if(r.a!==r.b)disagreements.push(r.id);}
 return {matrix,agreement:matrix.bothPass+matrix.bothFail,total:x.rows.length,disagreements};
}

const cases = [
  {
    "id": "four-case-matrix",
    "input": {
      "rows": [
        {
          "id": "1",
          "a": true,
          "b": true
        },
        {
          "id": "2",
          "a": true,
          "b": true
        },
        {
          "id": "3",
          "a": false,
          "b": false
        },
        {
          "id": "4",
          "a": true,
          "b": false
        }
      ]
    },
    "expected": {
      "matrix": {
        "bothPass": 2,
        "bothFail": 1,
        "aOnly": 1,
        "bOnly": 0
      },
      "agreement": 3,
      "total": 4,
      "disagreements": [
        "4"
      ]
    }
  },
  {
    "id": "opposite-disagreements",
    "input": {
      "rows": [
        {
          "id": "A",
          "a": true,
          "b": false
        },
        {
          "id": "B",
          "a": false,
          "b": true
        }
      ]
    },
    "expected": {
      "matrix": {
        "bothPass": 0,
        "bothFail": 0,
        "aOnly": 1,
        "bOnly": 1
      },
      "agreement": 0,
      "total": 2,
      "disagreements": [
        "A",
        "B"
      ]
    }
  },
  {
    "id": "duplicate-reviewed-case",
    "input": {
      "rows": [
        {
          "id": "A",
          "a": true,
          "b": false
        },
        {
          "id": "A",
          "a": false,
          "b": true
        }
      ]
    },
    "expected": {
      "error": "review-case-identity"
    }
  },
  {
    "id": "invalid-label",
    "input": {
      "rows": [
        {
          "id": "A",
          "a": "pass",
          "b": true
        }
      ]
    },
    "expected": {
      "error": "review-label"
    }
  }
];
for (const c of cases) assert.deepEqual(evaluate(c.input), c.expected, c.id);
console.log(JSON.stringify({checked:cases.length,caseIds:cases.map(c=>c.id)}));
下載可執行例子 ↓

判定分歧前可用此表找準則問題。本比例不含扣除偶然一致的統計,也不聲稱普遍評分可靠度。

相關資源