Skip to content

Commit

Permalink
SeaseLtd#109: Standardise parameter names to camelCase versions for E…
Browse files Browse the repository at this point in the history
…RR, NDCG, RR to add consistency with pom.xml parameters.
  • Loading branch information
Matt Pearce committed Mar 17, 2020
1 parent 11f6308 commit 11f295b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Map<String, Object>> metricConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 11f295b

Please sign in to comment.