[Lane 2 · kotlin-core] Precision/Recall/F1 — extract Accuracy's class-matching helpers into a shared internal file
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
- Tipo di issue
- Refactoring
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- kotlin
- Ambito
- machine-learning
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Create
ClassificationSupport.ktin the same package. Move the helpers there as
internaltop-level functions (or oneinternal object ClassificationSupport). Keep
names and signatures; keep error messages, but make the"Accuracy …"prefixes
metric-agnostic (pass the metric name in, or drop it). - Add one
internalentry 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.updatebecomes a ~5-line call to it that counts matches. This is what
ConfusionMatrixAccumulator(#1226) will call too. Accuracy's public surface must not change: same constructor, sameaccuracy()/
binaryAccuracy()factories, same behaviour. Run
./gradlew :skainet-lang:skainet-lang-core:apiCheck— the API dump must be unchanged
(everything you add isinternal).- Run the existing tests unchanged:
./gradlew :skainet-backends:skainet-backend-cpu:jvmTest --tests "sk.ainet.exec.metrics.*".
Acceptance
-
Accuracy.ktcontains no argmax / index-walking code of its own -
apiCheckpasses with no dump change -
AccuracyTestpasses 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.
- Lingua principale
- Kotlin
- Stelle
- 52
- Fork
- 15
- Merge medio
- 1g 15h
- PR unite (30g)
- 36
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di SKaiNET-developers/SKaiNET
-
coding good first issue size:xs skill:kotlin-core sub-issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
SKaiNET-developers/SKaiNET#1323 ·
I maintainer di solito rispondono entro 1 giorno
-
coding good first issue platform size:xs skill:js sub-issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SKaiNET-developers/SKaiNET#1232 ·
I maintainer di solito rispondono entro 1 giorno
-
skeep tracking
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
SKaiNET-developers/SKaiNET#1331 ·
I maintainer di solito rispondono entro 1 giorno
-
assessment size:s skill:review sub-issue
Difficoltà 4/5 1-2 giorni Idoneità per principianti 18/100
SKaiNET-developers/SKaiNET#1330 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue size:s skill:docs sub-issue
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
SKaiNET-developers/SKaiNET#1329 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di SKaiNET-developers/SKaiNET
Issue simili
-
M1 manhwa listApertaBug Domain changed
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
keiyoushi/extensions-source#19882 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
lugassawan/swe-workbench#799 ·
I maintainer di solito rispondono entro 1 giorno
-
Default book icon displayed while loadingForse già presa @Bhaskar-Guthula-137 l’ha presa oggi. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
kiwix/kiwix-android#5194 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
d4rken-org/butler#300 ·
I maintainer di solito rispondono entro 1 giorno