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

[Lane 2 · kotlin-core] Precision/Recall/F1 — extract Accuracy's class-matching helpers into a shared internal file

オープン
#1,225 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
3/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
kotlin

調査の方向性

Start with Accuracy.kt and its existing tests, then move the listed class-matching helpers into ClassificationSupport.kt in the same package and route Accuracy.update through the shared per-sample entry point. Run ./gradlew :skainet-lang:skainet-lang-core:apiCheck and ./gradlew :skainet-backends:skainet-backend-cpu:jvmTest --tests "sk.ainet.exec.metrics.*". Done means the tests pass, the API dump is unchanged, and Accuracy.kt has no argmax or index-walking code of its own.

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

説明

coding good first issue refactor size:s skill:kotlin-core sub-issue training

Sub-issue of #1222 (Precision, Recall and F1Score metrics).

Lane: 2 · Kotlin core (preparatory refactor)
Skill needed: Kotlin. No tensor-internals knowledge needed — everything you move already exists and already has tests.
Size: s (~2–3 h)
Blocked by: nothing. Unblocks #1226.

What to do

Accuracy.kt (skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/nn/metrics/Accuracy.kt)
carries, as private members, all the class-matching machinery the three new metrics also
need: argmax, argmaxTarget, insertClassIndex, validateIndexTargetShapes,
validatePredictions, normalizeDim, iterateOverSamples, plus the "hard Int32 targets
vs. soft FP32/FP16 targets" dispatch and the binary-threshold branch in
computeWithIndexTargets / computeWithSoftTargets. Copying that three more times is the
duplication git blame will ask about in six months.

  1. Create ClassificationSupport.kt in the same package. Move the helpers there as
    internal top-level functions (or one internal object ClassificationSupport). Keep
    names and signatures; keep error messages, but make the "Accuracy …" prefixes
    metric-agnostic (pass the metric name in, or drop it).
  2. Add one internal entry point that does the per-sample walk once for both target
    kinds and hands (predictedClass, targetClass) pairs to a callback, e.g.
    internal inline fun forEachPrediction(predictions, targets, dim, threshold, action: (predicted: Int, target: Int) -> Unit).
    Accuracy.update becomes a ~5-line call to it that counts matches. This is what
    ConfusionMatrixAccumulator (#1226) will call too.
  3. Accuracy's public surface must not change: same constructor, same accuracy() /
    binaryAccuracy() factories, same behaviour. Run
    ./gradlew :skainet-lang:skainet-lang-core:apiCheck — the API dump must be unchanged
    (everything you add is internal).
  4. Run the existing tests unchanged:
    ./gradlew :skainet-backends:skainet-backend-cpu:jvmTest --tests "sk.ainet.exec.metrics.*".

Acceptance

  • Accuracy.kt contains no argmax / index-walking code of its own
  • apiCheck passes with no dump change
  • AccuracyTest passes unmodified
  • PR title refactor(metrics): extract classification helpers from Accuracy (#1222)

Notes

Pure refactor — no new behaviour, so no new tests needed beyond the existing ones passing.
If you find Accuracy has a latent bug while you're in there (for example the
threshold branch reads logit index 1 when classCount == 2 but index 0 when
classCount == 1 — check that this is intended), don't fix it here; open a separate
bug and link it on the parent.

主要言語
Kotlin
スター
52
フォーク
15
平均マージ
23時間 34分
マージ済み PR(30日)
45

環境構築

はじめの一歩

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

SKaiNET-developers/SKaiNET のほかの issue

SKaiNET-developers/SKaiNET の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

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

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