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] adding prediction_field_type to inference config #55128

Conversation

benwtrent
Copy link
Member

Data frame analytics dynamically determines the classification field type. This field type then dictates the encoded JSON that is written to Elasticsearch.

Inference needs to know about this field type so that it may provide the EXACT SAME predicted values as analytics.

Here is added a new field prediction_field_type which indicates the desired type. Options are: string (DEFAULT), number, boolean (where close_to(1.0) == true, false otherwise).

Analytics provides the default prediction_field_type when the model is created from the process.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/ml-core (:ml)

@benwtrent
Copy link
Member Author

@elasticmachine update branch

@przemekwitek przemekwitek self-requested a review April 14, 2020 12:28
…' of github.com:benwtrent/elasticsearch into feature/ml-inference-handle-different-target-field-typs
@@ -382,6 +382,10 @@ include::{docdir}/ml/ml-shared.asciidoc[tag=inference-config-results-field]
`top_classes_results_field`::::
(Optional, string)
include::{docdir}/ml/ml-shared.asciidoc[tag=inference-config-classification-top-classes-results-field]

`prediction_field_type`::::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prediction_field_type

Not a big deal, but these properties are typically sorted alphabetically, and this seems to fall out of that sort order.

@benwtrent benwtrent requested a review from przemekwitek April 14, 2020 19:07
Copy link
Contributor

@przemekwitek przemekwitek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

throw new IllegalArgumentException(
"Cannot transform numbers other than 0.0 or 1.0 to boolean. Provided number [" + value + "]");
}
return (1.0D - value) <= EPS;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could areClose be used here as well for clarity?

import java.util.Locale;

/**
* The type of the predicted field.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/predicted/prediction/
?

@benwtrent
Copy link
Member Author

@elasticmachine update branch

@benwtrent benwtrent merged commit c1afda4 into elastic:master Apr 15, 2020
@benwtrent benwtrent deleted the feature/ml-inference-handle-different-target-field-typs branch April 15, 2020 12:32
benwtrent added a commit to benwtrent/elasticsearch that referenced this pull request Apr 15, 2020
Data frame analytics dynamically determines the classification field type. This field type then dictates the encoded JSON that is written to Elasticsearch. 

Inference needs to know about this field type so that it may provide the EXACT SAME predicted values as analytics. 

Here is added a new field `prediction_field_type` which indicates the desired type. Options are: `string` (DEFAULT), `number`, `boolean` (where close_to(1.0) == true, false otherwise). 

Analytics provides the default `prediction_field_type` when the model is created from the process.
benwtrent added a commit that referenced this pull request Apr 15, 2020
…55230)

* [ML] adding prediction_field_type to inference config (#55128)

Data frame analytics dynamically determines the classification field type. This field type then dictates the encoded JSON that is written to Elasticsearch. 

Inference needs to know about this field type so that it may provide the EXACT SAME predicted values as analytics. 

Here is added a new field `prediction_field_type` which indicates the desired type. Options are: `string` (DEFAULT), `number`, `boolean` (where close_to(1.0) == true, false otherwise). 

Analytics provides the default `prediction_field_type` when the model is created from the process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants