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 30064c6..55f2135 100644 Binary files a/go/goohrli/goohrli.a and b/go/goohrli/goohrli.a differ