From a2e5e878f32460388ae910e954b71a26ab7c10b9 Mon Sep 17 00:00:00 2001 From: Martin Bruse Date: Thu, 13 Jun 2024 08:45:10 +0000 Subject: [PATCH] Made --report and --leaderboard use different precision. Also hopefully fixed the bug where goohrli.a isn't always recreated when needed. --- CMakeLists.txt | 2 +- go/bin/score/score.go | 2 +- go/data/study.go | 9 ++++++--- go/goohrli/goohrli.a | Bin 20268442 -> 20268442 bytes 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b501a2d..e865a48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,7 @@ add_custom_command( $$\(find ${protobuf_BINARY_DIR} -name \"*.o\" ! -ipath \"*/google/protobuf/compiler/main.cc.o\"\) -o ${zimtohrli_goohrli_object} COMMAND ${CMAKE_AR} rcs ${zimtohrli_goohrli_archive} ${zimtohrli_goohrli_object} - DEPENDS zimtohrli_goohrli_glue + DEPENDS zimtohrli_goohrli_glue zimtohrli_base zimtohrli_visqol_adapter ) add_custom_target(zimtohrli_goohrli ALL DEPENDS ${zimtohrli_goohrli_archive}) diff --git a/go/bin/score/score.go b/go/bin/score/score.go index 4446f2c..689e8c7 100644 --- a/go/bin/score/score.go +++ b/go/bin/score/score.go @@ -208,7 +208,7 @@ func main() { if err != nil { log.Fatal(err) } - board, err := bundles.Leaderboard() + board, err := bundles.Leaderboard(15) if err != nil { log.Fatal(err) } diff --git a/go/data/study.go b/go/data/study.go index ada1751..65758cd 100644 --- a/go/data/study.go +++ b/go/data/study.go @@ -618,7 +618,7 @@ Created at %s fmt.Fprintf(res, "## Global leaderboard across all studies\n\n") - board, err := r.Leaderboard() + board, err := r.Leaderboard(2) if err != nil { return "", err } @@ -628,6 +628,7 @@ Created at %s // MSEScore is MSE for a score type across a set of studies. type MSEScore struct { + Decimals int ScoreType ScoreType MSE float64 MinScore float64 @@ -641,7 +642,8 @@ type MSEScores []MSEScore func (m MSEScores) String() string { table := Table{Row{"Score type", "MSE", "Min score", "Max score", "Mean score"}, nil} for _, score := range m { - table = append(table, Row{string(score.ScoreType), fmt.Sprintf("%.2f", score.MSE), fmt.Sprintf("%.2f", score.MinScore), fmt.Sprintf("%.2f", score.MaxScore), fmt.Sprintf("%.2f", score.MeanScore)}) + precisionString := fmt.Sprintf("%%.%df", score.Decimals) + table = append(table, Row{string(score.ScoreType), fmt.Sprintf(precisionString, score.MSE), fmt.Sprintf(precisionString, score.MinScore), fmt.Sprintf(precisionString, score.MaxScore), fmt.Sprintf(precisionString, score.MeanScore)}) } return fmt.Sprintf("### Mean square error (1 - Spearman correlation, or 1 - accuracy) per score type\n\n%s", table.String()) } @@ -659,7 +661,7 @@ func (m MSEScores) Swap(i, j int) { } // Leaderboard returns the sorted mean squared errors for each score type that is represented in all bundles. -func (r ReferenceBundles) Leaderboard() (MSEScores, error) { +func (r ReferenceBundles) Leaderboard(decimals int) (MSEScores, error) { representedScoreTypes := map[ScoreType]int{} for index, bundle := range r { if index == 0 { @@ -726,6 +728,7 @@ func (r ReferenceBundles) Leaderboard() (MSEScores, error) { numStudiesRecpripcal := 1.0 / float64(len(r)) for scoreType, squareSum := range sumOfSquares { result = append(result, MSEScore{ + Decimals: decimals, ScoreType: scoreType, MSE: squareSum * numStudiesRecpripcal, MeanScore: sums[scoreType] * numStudiesRecpripcal, diff --git a/go/goohrli/goohrli.a b/go/goohrli/goohrli.a index 30064c658ba02538d6398f7bb103a4b0d2b6f2bf..55f2135fe13db4309fd72f078c1776ed908006db 100644 GIT binary patch delta 1280 zcmY+;cbv}!9LMqdnzwLnx$(2l9_J7;&!|pzQ8p=le%*0aS>e>%{B@MkmviU*q@|Ri z&MGS!c6D0HY@o7dir44iulwWq`s4lAJI7xbl7lQcDyHHpp^_@4(h63HLKUWPl~Gxh zQ-sPZQc;RljAB(maf(-h66H}vRZ?YDQB_q_btS2WYO0oMtB&fbp6aWC8Y)?hl%mFJ zqNaL4&D2~i^q^X*m0GKf+NzyW)m|OcQJwUV9@Z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