Skip to content

Commit 5afa0b7

Browse files
authored
[ML][Inference] Unify top_classes object field names with analytics (#50858) (#50861)
1 parent 4629a97 commit 5afa0b7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/results/ClassificationInferenceResults.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ public String getWriteableName() {
110110

111111
public static class TopClassEntry implements Writeable {
112112

113-
public final ParseField CLASSIFICATION = new ParseField("classification");
114-
public final ParseField PROBABILITY = new ParseField("probability");
113+
public final ParseField CLASS_NAME = new ParseField("class_name");
114+
public final ParseField CLASS_PROBABILITY = new ParseField("class_probability");
115115

116116
private final String classification;
117117
private final double probability;
118118

119119
public TopClassEntry(String classification, Double probability) {
120-
this.classification = ExceptionsHelper.requireNonNull(classification, CLASSIFICATION);
121-
this.probability = ExceptionsHelper.requireNonNull(probability, PROBABILITY);
120+
this.classification = ExceptionsHelper.requireNonNull(classification, CLASS_NAME);
121+
this.probability = ExceptionsHelper.requireNonNull(probability, CLASS_PROBABILITY);
122122
}
123123

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

137137
public Map<String, Object> asValueMap() {
138138
Map<String, Object> map = new HashMap<>(2);
139-
map.put(CLASSIFICATION.getPreferredName(), classification);
140-
map.put(PROBABILITY.getPreferredName(), probability);
139+
map.put(CLASS_NAME.getPreferredName(), classification);
140+
map.put(CLASS_PROBABILITY.getPreferredName(), probability);
141141
return map;
142142
}
143143

0 commit comments

Comments
 (0)