-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] DataFrame Analytics: Regression results view #49667
[ML] DataFrame Analytics: Regression results view #49667
Conversation
Pinging @elastic/ml-ui (:ml) |
💚 Build Succeeded |
💚 Build Succeeded |
Looks good from screenshot, and have a few comments/questions.
|
As well as ensuring the predicted and actual field are anchored next to each other, I wonder if @peteharverson - having the three main fields at the top of the list makes sense. Added in 3fe1ace |
} | ||
}; | ||
|
||
const search = { |
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 it possible to do numeric search with the search bar? If so, might be useful to have an example of the syntax as a placeholder e.g. myField > 0.5
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 in 3fe1ace
const [clearTable, setClearTable] = useState(false); | ||
const [selectedFields, setSelectedFields] = useState([] as EsFieldName[]); | ||
const [isColumnsPopoverVisible, setColumnsPopoverVisible] = useState(false); | ||
const [searchQuery, setSearchQuery] = useState<SavedSearchQuery>(defaultSearchQuery); |
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.
If I change the sort on a column, the query seems to be retained (rightly), but on re-render after the sort, the query bar is empty.
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 catch - fixed with: 9f18919
@@ -120,7 +130,6 @@ export const EvaluatePanel: FC<Props> = ({ jobId, index, dependentVariable }) => | |||
)} | |||
</span> | |||
</EuiTitle> | |||
<EuiSpacer /> |
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.
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.
Fixed with 3fe1ace
|
||
const url = getResultsUrl(item.id, analysisType, destIndex, dependentVariable); | ||
// Disable 'View' link for regression until results view is complete | ||
const url = getResultsUrl(item.id, analysisType); |
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.
Should the View link be disabled until the job has finished?
Would be good to display the 'type' of the job, plus the status e.g. 'failed'. above the table. Also applies to Outlier jobs! |
💚 Build Succeeded |
💚 Build Succeeded |
Thank you for taking a look and the great comments! 😄 All comments have been addressed. Regarding the missing 'ml' field @sophiec20 asked about - yes it is possible. The evaluate panel will just show the error callouts (see last screenshot in PR description above) and the table will show any results from the dest index pattern. The |
💚 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.
Overall LGTM. Found a couple of issues related to sorting.
import { getTaskStateBadge } from '../../../analytics_management/components/analytics_list/columns'; | ||
import { DATA_FRAME_TASK_STATE } from '../../../analytics_management/components/analytics_list/common'; | ||
|
||
import { useExploreData, defaultSearchQuery } from './use_explore_data'; |
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.
|
||
// Used to sort columns: | ||
// Anchor on the left ml.is_training, <predictedField>, <actual> | ||
export const sortRegressionResultsColumns = ( |
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 sorting: SortingPropType = false; | ||
let onTableChange; | ||
|
||
if (columns.length > 0 && sortField !== '' && sortField !== undefined) { |
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.
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 outlier results view might have similar issues, as it’s based on the same code. Along with the other suggested changes that impact both views, I will address that in follow-ups.
})} | ||
</span> | ||
</EuiTitle> | ||
<EuiFlexGroup gutterSize="s"> |
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.
Would it be possible to add the job type and status to the Outliers results page too?
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 in 0eabc8d
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, just some minor suggestions.
@@ -68,6 +70,104 @@ export const sortColumns = (obj: EsDocSource, resultsField: string) => (a: strin | |||
return a.localeCompare(b); | |||
}; | |||
|
|||
export const sortRegressionResultsFields = ( |
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.
This could also be a factory similar to sortRegressionResultsColumns
, then you could pass it to the sort as .sort(sortRegressionResultsFields(jobConfig))
later on. Both sorting functions here would then have the same format.
let value = false; | ||
docs.forEach(row => { | ||
const source = row._source; | ||
if (source[k] !== null) { | ||
value = true; | ||
} | ||
}); | ||
return value; |
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.
nit: could make use of some
to avoid the need for let
, something like
return docs.some(row => row._source[k] !== null);
const [trainingEval, setTrainingEval] = useState<Eval>(defaultEval); | ||
const [generalizationEval, setGeneralizationEval] = useState<Eval>(defaultEval); | ||
const [isLoadingTraining, setIsLoadingTraining] = useState<boolean>(false); | ||
const [isLoadingGeneralization, setIsLoadingGeneralization] = useState<boolean>(false); | ||
|
||
const index = idx(jobConfig, _ => _.dest.index) as string; |
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.
Wondering why idx
is necessary here? The type DataFrameAnalyticsConfig
specifies .dest.index
not as optional.
<EuiPanel> | ||
<EuiLoadingSpinner className="mlRegressionExploration__evaluateLoadingSpinner" size="xl" /> | ||
</EuiPanel> |
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.
Suggest to change this to so we don't need a custom class:
<EuiPanel className="eui-textCenter">
<EuiLoadingSpinner size="xl" />
</EuiPanel>
useEffect(() => { | ||
(async function() { | ||
setIsLoadingJobConfig(true); | ||
const analyticsConfigs: GetDataFrameAnalyticsResponse = await ml.dataFrameAnalytics.getDataFrameAnalytics( |
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.
This will fail silently, suggest to add a try/catch
block and display a toast or callout for errors.
const field = predictedFieldSelected ? predictedFieldName : selectedFields[0]; | ||
const direction = predictedFieldSelected ? SORT_DIRECTION.DESC : SORT_DIRECTION.ASC; | ||
loadExploreData({ field, direction, searchQuery }); | ||
return; |
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.
nit: this return
can be removed.
const field = predictedFieldSelected ? predictedFieldName : selectedFields[0]; | ||
const direction = predictedFieldSelected ? SORT_DIRECTION.DESC : SORT_DIRECTION.ASC; | ||
loadExploreData({ field, direction, searchQuery }); | ||
return; |
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.
nit: this return
can be removed.
I'll be addressing the sorting issue @peteharverson mentioned and the refactor suggestions @walterra mentioned in a follow-up as those issues also affect the outlier results view. |
@elasticmachine merge upstream |
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. Happy for the issues which also affect the Outliers page to be done in a follow-up.
💚 Build Succeeded |
* enable analytics table view link for regression jobs * add results table component * can filter for training/testing * add search functionality to table * move shared types to analytics types file * anchor isTraining,predicted,actual columns to left. * ensure search string persists in search bar input * show jobStatus badge in results view * add jobType, status badge to outlier exploration page * update exploration tests
* enable analytics table view link for regression jobs * add results table component * can filter for training/testing * add search functionality to table * move shared types to analytics types file * anchor isTraining,predicted,actual columns to left. * ensure search string persists in search bar input * show jobStatus badge in results view * add jobType, status badge to outlier exploration page * update exploration tests
Summary
Related meta issue: #47890
View
link in Analytics jobs list for regression jobsdependent_variable
, the predicted value, andis_training
valueChecklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] Documentation was added for features that require explanation or tutorialsFor 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