[Lane 2 · kotlin-core] Precision/Recall/F1 — Averaging enum + internal ConfusionMatrixAccumulator
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- kotlin
- Área
- machine-learning
Línea de trabajo
First read Accuracy.kt, the helpers from #1225, and the contract decisions in #1224; this issue is blocked on both. Implement the public Averaging enum and the internal accumulator and reducer in sk.ainet.lang.nn.metrics, then test the reducer’s modes and zero-division case. Run ./gradlew :skainet-lang:skainet-lang-core:apiDump; done means the API dump adds Averaging only and the fixture produces the specified counts.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Sub-issue of #1222 (Precision, Recall and F1Score metrics).
Lane: 2 · Kotlin core
Skill needed: Kotlin; read Accuracy.kt and the helpers from #1225 first.
Size: s (~3–4 h)
Blocked by: #1225 (helpers) and the contract decisions from #1224 (zero-division, macro class set, binary mode).
What to do
- Add
public enum class Averaging { BINARY, MACRO, MICRO }in
sk.ainet.lang.nn.metrics(own file, KDoc on each value — this is public API).
Semantics per #1224; the working definitions are:BINARY— report class1(the positive class) only; requires ≤ 2 classes;MACRO— unweighted mean of the per-class value over the class set decided in #1224;MICRO— pool TP / FP / FN over all classes, then apply the formula once.
- Add
internal class ConfusionMatrixAccumulator(dim: Int = -1, threshold: Float? = null)
withfun <T : DType, V> update(predictions: Tensor<T, V>, targets: Tensor<out DType, *>)
— walks every sample via the #1225 helper and increments per-classtp/fp/fn
(Longcounters keyed by class index; a wrong prediction is one FP for the predicted
class and one FN for the target class);fun counts(): Map<Int, ClassCounts>(a smallinternal data class ClassCounts(tp, fp, fn));fun reset().
- Add
internal fun reduce(counts, averaging, perClass: (tp: Long, fp: Long, fn: Long) -> Double): Double
implementing the three averaging modes and the zero-division convention from #1224
in one place, soPrecision,RecallandF1Scoreeach contribute only a formula. - Tests: the accumulator is
internaltoskainet-lang-core, and the metric tests live
inskainet-backend-cpu(they needDirectCpuExecutionContextto build tensors). Two
options — pick one and say which in the PR:- test it through
Precision/Recallin #1227 / #1228 (then this PR ships
with areduce()unit test only, which needs no tensors), or - put an accumulator test in
skainet-lang-core'scommonTest, building tensors with
DenseTensorDataFactory().fromFloatArray(...)+SimpleTensor(...)the way
OperationExecutor.createTensordoes.
- test it through
./gradlew :skainet-lang:skainet-lang-core:apiDump— the dump gainsAveragingand
nothing else.
Acceptance
-
Averagingpublic, documented, in the API dump -
ConfusionMatrixAccumulator+reduce()internal, no public surface -
reduce()tested for macro / micro / binary and the zero-division case - Reference fixture from #1224 (
pred [2,0,1,2],target [2,1,1,0]) yields counts
{0: (0,1,1), 1: (1,0,1), 2: (1,1,0)}as (tp, fp, fn)
Notes
Don't build Precision / Recall / F1Score here even though it's tempting — they are
separate good first issues (#1227, #1228, #1229) precisely so three people can each
ship one small PR against this accumulator.
- Lenguaje dominante
- Kotlin
- Estrellas
- 52
- Forks
- 15
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 36
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de SKaiNET-developers/SKaiNET
-
coding good first issue size:xs skill:kotlin-core sub-issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
SKaiNET-developers/SKaiNET#1323 ·
Los mantenedores suelen responder en 1 día
-
coding good first issue platform size:xs skill:js sub-issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
SKaiNET-developers/SKaiNET#1232 ·
Los mantenedores suelen responder en 1 día
-
skeep tracking
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
SKaiNET-developers/SKaiNET#1331 ·
Los mantenedores suelen responder en 1 día
-
assessment size:s skill:review sub-issue
Dificultad 4/5 1-2 días Aptitud para principiantes 18/100
SKaiNET-developers/SKaiNET#1330 ·
Los mantenedores suelen responder en 1 día
-
documentation good first issue size:s skill:docs sub-issue
Dificultad 3/5 1-2 días Aptitud para principiantes 78/100
SKaiNET-developers/SKaiNET#1329 ·
Los mantenedores suelen responder en 1 día
Todos los issues de SKaiNET-developers/SKaiNET
Issues similares
-
afk-ok area:data-quality importer size:S
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
enorm-labs/event-junkie#3166 ·
Los mantenedores suelen responder en 1 día
-
bugbane/qf good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
osservatorionessuno/bugbane#173 ·
Los mantenedores suelen responder en 1 día
-
Android: build fails with Android Gradle Plugin 9 (kotlinOptions, lintOptions, proguard-android.txt)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
capacitor-community/stripe#544 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
theopenconversationkit/tock#2113 ·
Los mantenedores suelen responder en 1 día