[Lane 2 · kotlin-core] Precision metric
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 58/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- kotlin
調査の方向性
This task is explicitly blocked by #1226, which provides the accumulator and Averaging; check that it is complete before starting. Then read Accuracy.kt and ConfusionMatrixAccumulator, and follow the issue's paths for Precision.kt and PrecisionTest.kt, using AccuracyTest.kt as the test reference. Run the listed apiDump and JVM metric tests; done means the public API is in the dump and all six test cases pass.
索引モデルが issue の本文から書いたものです。
説明
Sub-issue of #1222 (Precision, Recall and F1Score metrics).
Lane: 2 · Kotlin core
Skill needed: Kotlin. Read Accuracy.kt and ConfusionMatrixAccumulator first — this task is mostly wiring.
Size: s (~2–3 h)
Blocked by: #1226 (accumulator + Averaging)
What to do
- Add
public class Precision(averaging: Averaging = Averaging.MACRO, dim: Int = -1, threshold: Float? = null) : Metric
inskainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/nn/metrics/Precision.kt:override val name = "precision";update(...)delegates to a privateConfusionMatrixAccumulator(dim, threshold);compute()=reduce(acc.counts(), averaging) { tp, fp, fn -> if (tp + fp == 0L) 0.0 else tp.toDouble() / (tp + fp) };reset()delegates.
MirrorAccuracy.kt's KDoc style (what the metric means, thedim/thresholdsemantics, whataveragingdoes).
- Add factory functions at the bottom of the file mirroring
accuracy()/binaryAccuracy():
public fun precision(averaging: Averaging = Averaging.MACRO, dim: Int = -1): Metricand
public fun binaryPrecision(threshold: Float = 0.5f): Metric. - Tests in
skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/metrics/PrecisionTest.kt,
copyingAccuracyTest.kt's tensor helpers. Cover, with hand-computed expected values
(see the parent issue and #1224 for the reference fixturepred [2,0,1,2],target [2,1,1,0]):- macro multi-class with
Int32index targets → 0.5; - micro multi-class → 0.5 (and assert it equals
Accuracyon the same batch); - the same batch with soft (
FP32one-hot) targets gives the same result; - binary with
threshold, 2-class logits; - accumulation across two
update()calls equals one call on the concatenated batch; - zero-division: a class with TP+FP+FN = 0 contributes
0.0(per #1224), and
compute()on a fresh metric returns0.0.
- macro multi-class with
./gradlew :skainet-lang:skainet-lang-core:apiDumpand
./gradlew :skainet-backends:skainet-backend-cpu:jvmTest --tests "sk.ainet.exec.metrics.*".
Acceptance
-
Precision+precision()+binaryPrecision()public and in the API dump - All six test cases above pass on JVM
- No duplicated argmax / iteration logic — everything goes through the accumulator
- PR links this issue and #1222; PR body states "unit tests only; ground-truth wiring tracked in SKEEP-005 (#1223)"
Notes
Precision answers "of what I predicted positive, how much was right". The twin task #1228 (Recall) is the same shape with tp / (tp + fn) — if you take both, fine, but they are filed separately so two people can each ship one.
- 主要言語
- Kotlin
- スター
- 52
- フォーク
- 15
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 37
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SKaiNET-developers/SKaiNET のほかの issue
-
coding good first issue platform size:xs skill:js sub-issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
SKaiNET-developers/SKaiNET#1232 ·
メンテナーはふだん 1 日以内に返信
-
compute-backend dsl/api enhancement size:m skill:kotlin-core skill:numerics
難易度 5/5 1週間以上 初心者へのやさしさ 18/100
SKaiNET-developers/SKaiNET#1343 ·
メンテナーはふだん 1 日以内に返信
-
compute-backend dsl/api enhancement size:m skill:kotlin-core skill:numerics
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
SKaiNET-developers/SKaiNET#1342 ·
メンテナーはふだん 1 日以内に返信
-
skeep tracking
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
SKaiNET-developers/SKaiNET#1331 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
assessment size:s skill:review sub-issue
難易度 4/5 1〜2日 初心者へのやさしさ 18/100
SKaiNET-developers/SKaiNET#1330 ·
メンテナーはふだん 1 日以内に返信
SKaiNET-developers/SKaiNET の issue をすべて見る
似ている issue
-
afk-ok area:data-quality importer size:S
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
enorm-labs/event-junkie#3301 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
rustyrazorblade/easy-db-lab#1017 ·
メンテナーはふだん 1 日以内に返信
-
enhancement impact:U1 later P3 reach:R2 size:S
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100