Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#1,225 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
kotlin

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Kotlin
Estrellas
52
Forks
15
Merge medio
1 d 15 h
PR fusionados (30 d)
36

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de SKaiNET-developers/SKaiNET

Todos los issues de SKaiNET-developers/SKaiNET

Issues similares

Más issues de Kotlin

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.