From 11f295b10067985579b686923d75d057687f325d Mon Sep 17 00:00:00 2001 From: Matt Pearce Date: Tue, 17 Mar 2020 13:41:43 +0000 Subject: [PATCH] #109: Standardise parameter names to camelCase versions for ERR, NDCG, RR to add consistency with pom.xml parameters. --- .../core/domain/metrics/ParameterizedMetricClassManager.java | 3 +++ .../rre/core/domain/metrics/impl/ExpectedReciprocalRank.java | 4 ++-- .../java/io/sease/rre/core/domain/metrics/impl/NDCGAtK.java | 4 ++-- .../io/sease/rre/core/domain/metrics/impl/ReciprocalRank.java | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/rre-core/src/main/java/io/sease/rre/core/domain/metrics/ParameterizedMetricClassManager.java b/rre-core/src/main/java/io/sease/rre/core/domain/metrics/ParameterizedMetricClassManager.java index 7e6271d5..c12b73a9 100644 --- a/rre-core/src/main/java/io/sease/rre/core/domain/metrics/ParameterizedMetricClassManager.java +++ b/rre-core/src/main/java/io/sease/rre/core/domain/metrics/ParameterizedMetricClassManager.java @@ -22,6 +22,9 @@ public class ParameterizedMetricClassManager extends SimpleMetricClassManager im private final static Logger LOGGER = LogManager.getLogger(ParameterizedMetricClassManager.class); public static final String NAME_KEY = "name"; + public static final String MAXIMUM_GRADE_KEY = "maximumGrade"; + public static final String MISSING_GRADE_KEY = "missingGrade"; + private static final String METRIC_CLASS_KEY = "class"; private final Map> metricConfiguration; diff --git a/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/ExpectedReciprocalRank.java b/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/ExpectedReciprocalRank.java index dcc84840..40608b88 100644 --- a/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/ExpectedReciprocalRank.java +++ b/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/ExpectedReciprocalRank.java @@ -56,8 +56,8 @@ public class ExpectedReciprocalRank extends Metric { * or 2, depending whether or not {@code maxgrade} has been specified. * @param name the name to use for this metric. If {@code null}, will default to {@code ERR@k}. */ - public ExpectedReciprocalRank(@JsonProperty("maxgrade") final Float maxgrade, - @JsonProperty("defaultgrade") final Float defaultgrade, + public ExpectedReciprocalRank(@JsonProperty(ParameterizedMetricClassManager.MAXIMUM_GRADE_KEY) final Float maxgrade, + @JsonProperty(ParameterizedMetricClassManager.MISSING_GRADE_KEY) final Float defaultgrade, @JsonProperty("k") final int k, @JsonProperty(ParameterizedMetricClassManager.NAME_KEY) final String name) { super(Optional.ofNullable(name).orElse("ERR@" + k)); diff --git a/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/NDCGAtK.java b/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/NDCGAtK.java index 6bba45fd..cef94a5d 100644 --- a/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/NDCGAtK.java +++ b/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/NDCGAtK.java @@ -72,8 +72,8 @@ public NDCGAtK(final int k) { * @param name the name to use for this metric. If {@code null}, will default to {@code NDCG@k}. */ public NDCGAtK(@JsonProperty("k") final int k, - @JsonProperty("maxgrade") final Float maxgrade, - @JsonProperty("defaultgrade") final Float defaultgrade, + @JsonProperty(ParameterizedMetricClassManager.MAXIMUM_GRADE_KEY) final Float maxgrade, + @JsonProperty(ParameterizedMetricClassManager.MISSING_GRADE_KEY) final Float defaultgrade, @JsonProperty(ParameterizedMetricClassManager.NAME_KEY) final String name) { super(Optional.ofNullable(name).orElse("NDCG@" + k)); if (maxgrade == null) { diff --git a/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/ReciprocalRank.java b/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/ReciprocalRank.java index 04a7928a..6253bd4d 100644 --- a/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/ReciprocalRank.java +++ b/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/ReciprocalRank.java @@ -60,8 +60,8 @@ public ReciprocalRank() { * @param name the name to use for this metric. If {@code null}, will default to {@code RR@k}. */ public ReciprocalRank(@JsonProperty("k") final int k, - @JsonProperty("maxgrade") final Float maxgrade, - @JsonProperty("defaultgrade") final Float defaultgrade, + @JsonProperty(ParameterizedMetricClassManager.MAXIMUM_GRADE_KEY) final Float maxgrade, + @JsonProperty(ParameterizedMetricClassManager.MISSING_GRADE_KEY) final Float defaultgrade, @JsonProperty(ParameterizedMetricClassManager.NAME_KEY) final String name) { super(Optional.ofNullable(name).orElse("RR@" + k)); this.k = k;