From 5afa0b71e914551b8447689b711186571a4b5f94 Mon Sep 17 00:00:00 2001 From: Benjamin Trent Date: Fri, 10 Jan 2020 12:00:37 -0500 Subject: [PATCH] [ML][Inference] Unify top_classes object field names with analytics (#50858) (#50861) --- .../results/ClassificationInferenceResults.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/results/ClassificationInferenceResults.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/results/ClassificationInferenceResults.java index 526b37314b56b..226a9c1104346 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/results/ClassificationInferenceResults.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/results/ClassificationInferenceResults.java @@ -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 { @@ -136,8 +136,8 @@ public double getProbability() { public Map asValueMap() { Map 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; }