Skip to content

Commit

Permalink
[ML][Inference] Unify top_classes object field names with analytics (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
benwtrent authored Jan 10, 2020
1 parent 4629a97 commit 5afa0b7
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ public String getWriteableName() {

public static class TopClassEntry implements Writeable {

public final ParseField CLASSIFICATION = new ParseField("classification");
public final ParseField PROBABILITY = new ParseField("probability");
public final ParseField CLASS_NAME = new ParseField("class_name");
public final ParseField CLASS_PROBABILITY = new ParseField("class_probability");

private final String classification;
private final double probability;

public TopClassEntry(String classification, Double probability) {
this.classification = ExceptionsHelper.requireNonNull(classification, CLASSIFICATION);
this.probability = ExceptionsHelper.requireNonNull(probability, PROBABILITY);
this.classification = ExceptionsHelper.requireNonNull(classification, CLASS_NAME);
this.probability = ExceptionsHelper.requireNonNull(probability, CLASS_PROBABILITY);
}

public TopClassEntry(StreamInput in) throws IOException {
Expand All @@ -136,8 +136,8 @@ public double getProbability() {

public Map<String, Object> asValueMap() {
Map<String, Object> map = new HashMap<>(2);
map.put(CLASSIFICATION.getPreferredName(), classification);
map.put(PROBABILITY.getPreferredName(), probability);
map.put(CLASS_NAME.getPreferredName(), classification);
map.put(CLASS_PROBABILITY.getPreferredName(), probability);
return map;
}

Expand Down

0 comments on commit 5afa0b7

Please sign in to comment.