Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML][Inference] Unify top_classes object field names with analytics #50858

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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