-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] DF Regression: fix custom results_field and prediction_field_name not considered in eval config #48599
[ML] DF Regression: fix custom results_field and prediction_field_name not considered in eval config #48599
Conversation
Pinging @elastic/ml-ui (:ml) |
💚 Build Succeeded |
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.
Added a question about getPredictionFieldName()
.
@@ -81,6 +82,15 @@ export const getDependentVar = (analysis: AnalysisConfig) => { | |||
return depVar; | |||
}; | |||
|
|||
export const getPredictionFieldName = (analysis: AnalysisConfig) => { | |||
// Default to dependent_variable |
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.
The comment here says Default to dependent_variable
but I don't see that happening, is this comment meant as a TODO or does it happen somewhere else?
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'd also suggest having all comments as tsdoc for functions. More convenient to look up in IDE and let us generate the code documentation
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.
Good one @walterra - I've clarified this comment in 695aaed
I just wanted to make it clear that if prediction_field_name is not defined/set it will be defaulted to dependent_variable when the config is created.
@darnautov - good suggestion, though in this case it's just more of an FYI comment for where this is used. Also I think TypeScript kind of accomplishes the same functionality by defining the parameters, return value, etc. 🤔
const query = { term: {} }; | ||
// @ts-ignore TODO: fix types here | ||
query.term[`${resultsField}.is_training`] = { value: isTraining }; |
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.
You could try to do the original assignment with the computed property name:
const query = { term: { [`${resultsField}.is_training`]: { value: isTraining } } }'
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.
Nice suggestion! Updated in 695aaed
@@ -81,6 +82,15 @@ export const getDependentVar = (analysis: AnalysisConfig) => { | |||
return depVar; | |||
}; | |||
|
|||
export const getPredictionFieldName = (analysis: AnalysisConfig) => { | |||
// Default to dependent_variable |
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'd also suggest having all comments as tsdoc for functions. More convenient to look up in IDE and let us generate the code documentation
getValuesFromResponse, | ||
loadEvalData, | ||
Eval, | ||
} from '../../../../common'; | ||
import { isCompletedAnalyticsJob } from './common'; | ||
import { isRegressionAnalysis } from '../../../../common/analytics'; | ||
// import { ExpandedRowMessagesPane } from './expanded_row_messages_pane'; |
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.
commented import (not part of the changes, but should be removed I guess)
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 believe this was added in the original code for when the messages become available - which I think they are now if not very soon. I think it's worth keeping in as it will be used very soon. 😄
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.
Latest changes LGTM
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.
LGTM
💚 Build Succeeded |
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.
One comment about prediction_field_name
needing to be set, but otherwise tested this and LGTM
}) => { | ||
const results: LoadEvaluateResult = { success: false, eval: null, error: null }; | ||
const defaultPredictionField = `${dependentVariable}_prediction`; |
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.
When testing this I noticed that it is possible to create a job without entering the prediction_field_name
. The Create button should be disabled unless they have entered a prediction_field_name
.
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.
The prediction_field_name
is optional (defaults to whatever <dependent_variable>_prediction
) - do you mean the dependent_variable
? If so that was fixed in this commit : df6b171
💚 Build Succeeded |
💔 Build Failed |
💚 Build Succeeded |
…e not considered in eval config (elastic#48599) * consider results_field and prediction_field_name in eval congif * temp typescript fix for evaluatePanel not being used yet * fix typescript error. clarify comment * Disable create button if dependentVariable not set * ensure advancedEditor json valid at every change * update reducer test
…e not considered in eval config (elastic#48599) * consider results_field and prediction_field_name in eval congif * temp typescript fix for evaluatePanel not being used yet * fix typescript error. clarify comment * Disable create button if dependentVariable not set * ensure advancedEditor json valid at every change * update reducer test
…e not considered in eval config (#48599) (#48714) * consider results_field and prediction_field_name in eval congif * temp typescript fix for evaluatePanel not being used yet * fix typescript error. clarify comment * Disable create button if dependentVariable not set * ensure advancedEditor json valid at every change * update reducer test
…e not considered in eval config (#48599) (#48713) * consider results_field and prediction_field_name in eval congif * temp typescript fix for evaluatePanel not being used yet * fix typescript error. clarify comment * Disable create button if dependentVariable not set * ensure advancedEditor json valid at every change * update reducer test
Summary
This PR takes into account a custom
results_field
andprediction_field_name
that could be set by the user using the advanced editor when creating a regression job.The custom fields are used if set when creating the payload for the
/_evaluate
endpoint. Default 'ml'results_field
is used when one is not set.<dependent_variable>_prediction
is used whenprediction_field_name
is not set.dependent_variable
has not been setChecklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support- [ ] Documentation was added for features that require explanation or tutorials- [ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
- [ ] This was checked for breaking API changes and was labeled appropriately- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately