-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[ML] add new inference_config field to trained model config #54421
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] add new inference_config field to trained model config #54421
Conversation
|
Pinging @elastic/ml-core (:ml) |
|
@elasticmachine update branch |
…of github.com:benwtrent/elasticsearch into feature/ml-inference-add-infer-config-to-model-config
|
@elasticmachine update branch |
| <5> Optionally, a human-readable description | ||
| <6> Optionally, an object map contain metadata about the model | ||
| <7> Optionally, an array of tags to organize the model | ||
| <8> The default inference config to use with the model. Must match the underlying |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the new object needs to be added in the definitions section too (e.g. https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference.html#ml-put-inference-trained-model)
davidkyle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great change! LGTM
One request could we now make the inference config for the inference processor optional? i.e. remove the need for
"inference_config": {
"regression": {}
}
| public class ClassificationConfigTests extends AbstractXContentTestCase<ClassificationConfig> { | ||
|
|
||
| public static ClassificationConfig randomClassificationConfig() { | ||
| return new ClassificationConfig(randomBoolean() ? null : randomIntBetween(-1, 10), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is -1 valid for numTopClasses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, indicates "_all"
| } | ||
|
|
||
| boolean isNoop(ClassificationConfig originalConfig) { | ||
| return (resultsField == null || originalConfig.getResultsField().equals(resultsField)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flip the test around so you call equals on the one you've proved to be non-null.
resultsField == null || resultsField.equals(originalConfig.getResultsField())
I know getResultsField() can't return null as it has a default value but it seems sensible to reverse it anyway. Also topClassesResultsField below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
roger
| Regression regression = ((Regression)analytics.getAnalysis()); | ||
| return new RegressionConfig(RegressionConfig.DEFAULT_RESULTS_FIELD, | ||
| regression.getBoostedTreeParams().getNumTopFeatureImportanceValues() == null ? | ||
| 0 : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let RegressionConfig pick the default value (it does this in the constructor anyway)
RegressionConfig(RegressionConfig.DEFAULT_RESULTS_FIELD,
regression.getBoostedTreeParams().getNumTopFeatureImportanceValues())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with ClassificationConfig
Part of me is still reticent to do that. It is right now, the only indication of the "inference type". I suppose we can remove it in the future for sure. I don't think we should do it in this PR though. |
|
@elasticmachine update branch |
lcawl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation LGTM
|
@elasticmachine update branch |
…54421) A new field called `inference_config` is now added to the trained model config object. This new field allows for default inference settings from analytics or some external model builder. The inference processor can still override whatever is set as the default in the trained model config.
…4421) (#54647) * [ML] add new inference_config field to trained model config (#54421) A new field called `inference_config` is now added to the trained model config object. This new field allows for default inference settings from analytics or some external model builder. The inference processor can still override whatever is set as the default in the trained model config. * fixing for backport
A new field called
inference_configis now added to the trained model config object. This new field allows for default inference settings from analytics or some external model builder.The inference processor can still override whatever is set as the default in the trained model config.
Docs preview: