[ML] fix bugs with prediction field value settings#55333
Merged
benwtrent merged 3 commits intoelastic:masterfrom Apr 17, 2020
Merged
[ML] fix bugs with prediction field value settings#55333benwtrent merged 3 commits intoelastic:masterfrom
benwtrent merged 3 commits intoelastic:masterfrom
Conversation
Collaborator
|
Pinging @elastic/ml-core (:ml) |
...rc/main/java/org/elasticsearch/xpack/core/ml/inference/trainedmodel/PredictionFieldType.java
Show resolved
Hide resolved
...st/java/org/elasticsearch/xpack/core/ml/inference/trainedmodel/PredictionFieldTypeTests.java
Show resolved
Hide resolved
Member
Author
|
@elasticmachine update branch |
przemekwitek
approved these changes
Apr 17, 2020
| } | ||
| // Quick check to verify that the string rep is LIKELY a number | ||
| // Still handles the case where it throws and then returns the underlying value | ||
| if (stringRep.charAt(0) == '-' || Character.isDigit(stringRep.charAt(0))) { |
There was a problem hiding this comment.
Could we just drop it and rely solely on parseLong?
Or is this some kind of perf optimization? If so, are you sure it is really faster?
Member
Author
There was a problem hiding this comment.
It is way faster if stringRep is consistently not a number (which could easily be the case). Every call that it is not a number throws an exception, and the JVM has to build a trace.
benwtrent
added a commit
to benwtrent/elasticsearch
that referenced
this pull request
Apr 17, 2020
This fixes two unreleased bugs: 1. Prediction value type of `number` might show unexpected classes Analytics created models may have class labels like `1, 5, 10` (or some collection of discrete, whole numbers). These labels are passed to the inference model config in the `classification_labels` field. When the predicted value format is `numeric` it should attempt to see if the classification labels are provided and are numeric. If so, use those. If not, use the underlying value. 2. When supplying an update overwrite, inference was losing the default prediction field value. This is because it was not copied over in the copy ctor in the ClassificationConfig.Builder class. closes elastic#55332
benwtrent
added a commit
that referenced
this pull request
Apr 17, 2020
…5394) * [ML] fix bugs with prediction field value settings (#55333) This fixes two unreleased bugs: 1. Prediction value type of `number` might show unexpected classes Analytics created models may have class labels like `1, 5, 10` (or some collection of discrete, whole numbers). These labels are passed to the inference model config in the `classification_labels` field. When the predicted value format is `numeric` it should attempt to see if the classification labels are provided and are numeric. If so, use those. If not, use the underlying value. 2. When supplying an update overwrite, inference was losing the default prediction field value. This is because it was not copied over in the copy ctor in the ClassificationConfig.Builder class. closes #55332
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes two unreleased bugs:
numbermight show unexpected classesAnalytics created models may have class labels like
1, 5, 10(or some collection of discrete, whole numbers). These labels are passed to the inference model config in theclassification_labelsfield.When the predicted value format is
numericit should attempt to see if the classification labels are provided and are numeric. If so, use those. If not, use the underlying value.closes #55332