[Lane 2 · kotlin-core] F1Score metric
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 57/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- kotlin
- Lĩnh vực
- machine-learning
Hướng nghiên cứu
Read Precision.kt and Recall.kt from the blocking issues, then inspect the accumulator and Metric.kt before implementing F1Score.kt at the specified core path. Add the specified tests in F1ScoreTest.kt and run the JVM metrics tests plus the API dump command. Done means the listed cases pass and the public API appears in the dump; this issue is blocked by #1227 and #1228 (or at least #1226).
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Sub-issue of #1222 (Precision, Recall and F1Score metrics).
Lane: 2 · Kotlin core
Skill needed: Kotlin. Read Precision.kt / Recall.kt from #1227 / #1228 first — F1Score composes their formulas over one accumulator.
Size: s (~2–3 h)
Blocked by: #1227 and #1228 (or at least #1226 — F1 only needs the accumulator, but its tests cross-check against Precision/Recall).
What to do
- Add
public class F1Score(averaging: Averaging = Averaging.MACRO, dim: Int = -1, threshold: Float? = null) : Metric
inskainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/nn/metrics/F1Score.kt:override val name = "f1";- one private
ConfusionMatrixAccumulator— do not hold aPrecisionand a
Recalland callupdate()on both; that walks every batch twice; compute()=reduce(acc.counts(), averaging) { tp, fp, fn -> per-class F1 }where
per-class F1 =2·tp / (2·tp + fp + fn)(algebraically2PR/(P+R), but this form has
a single zero-division check:0.0when2·tp + fp + fn == 0).- Note that for
MACRO, F1 is the mean of per-class F1s — not the F1 of macro-P and
macro-R. Say so in the KDoc; it is the most common F1 implementation mistake.
- Factories:
public fun f1Score(averaging: Averaging = Averaging.MACRO, dim: Int = -1): Metric
andpublic fun binaryF1Score(threshold: Float = 0.5f): Metric. - Tests in
skainet-backends/skainet-backend-cpu/src/commonTest/kotlin/sk/ainet/exec/metrics/F1ScoreTest.kt,
reference fixturepred [2,0,1,2],target [2,1,1,0]:- macro F1 → 0.4444 (per-class
[0, 0.667, 0.667]), and assert it is not
2·0.5·0.5/(0.5+0.5) = 0.5— the mean-of-F1s vs. F1-of-means trap; - micro F1 → 0.5, equal to micro precision, micro recall and accuracy;
- binary with threshold on 2-class logits, hand-computed;
- a class with TP+FP+FN = 0 contributes
0.0; fresh metriccompute()is0.0; - accumulation across two
update()calls equals one concatenated call; computeForBatch(fromMetric.kt) round-trips throughreset().
- macro F1 → 0.4444 (per-class
./gradlew :skainet-lang:skainet-lang-core:apiDumpand
./gradlew :skainet-backends:skainet-backend-cpu:jvmTest --tests "sk.ainet.exec.metrics.*".
Acceptance
-
F1Score+f1Score()+binaryF1Score()public and in the API dump - All test cases above pass on JVM
- Batches are walked once per
update() - PR body states "unit tests only; ground-truth wiring tracked in SKEEP-005 (#1223)"
Notes
Reference: sklearn f1_score docs — https://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html ;
torchmetrics F1Score — https://lightning.ai/docs/torchmetrics/stable/classification/f1_score.html .
Closing this issue is what unblocks the platform-parity lane (#1230–#1233) and review (#1235).
- Ngôn ngữ chính
- Kotlin
- Star
- 52
- Fork
- 15
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 37
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SKaiNET-developers/SKaiNET
-
coding good first issue platform size:xs skill:js sub-issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SKaiNET-developers/SKaiNET#1232 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
skeep tracking
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
SKaiNET-developers/SKaiNET#1331 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
assessment size:s skill:review sub-issue
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 18/100
SKaiNET-developers/SKaiNET#1330 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue size:s skill:docs sub-issue
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
SKaiNET-developers/SKaiNET#1329 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
coding good first issue size:s skill:kotlin-core sub-issue
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 75/100
SKaiNET-developers/SKaiNET#1328 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SKaiNET-developers/SKaiNET
Issue tương tự
-
[BUG] Navigation drawer drops library-name suffixes without ellipsis (1.0.8, NVIDIA Shield)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
damontecres/Wholphin#2069 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Android (vision-camera-location): HybridLocationManager never quits its HandlerThread on disposeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
margelo/react-native-vision-camera#4217 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
saisaharsh3/Leftovers#13 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100
navikt/esyfo-narmesteleder#700 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[DEV] Update ktlintĐang mởbackend maintenance
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
digitalfabrik/entitlementcard#3183 ·
Maintainer thường phản hồi trong vòng 7 ngày