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]DF Analytics exploration: default filter of results page by defaultIsTraining value in url #78303

Conversation

alvarezmelissa87
Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 commented Sep 23, 2020

Summary

Related meta issue: #77182

This PR handles the addition of an defaultIsTraining query param in the url to show a subset of data by default. The relevant analytics exploration pages (classification, regression) will show result table and evaluate panel filtered by the defaultIsTraining value in the url.

Once the default filter has been applied, the defaultIsTraining param is cleared from the URL to prevent confusion.

Example query params: ...ml/data_frame_analytics/exploration?_g=(ml:(analysisType:classification,defaultIsTraining:!t,jobId:flights-class-05))

Checklist

Delete any items that are not applicable to this PR.

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@peteharverson
Copy link
Contributor

peteharverson commented Sep 23, 2020

Testing with this bookmarked URL

http://localhost:5601/ulp/app/ml/data_frame_analytics/exploration?_g=(ml:(analysisType:classification,jobId:uci_adult_income_classification,isTraining:false))

The table seems to be filtered correctly, but the label on the Evaluate panel refers to 'entire dataset':

image


Thanks for taking a look @peteharverson 😄 Updated the default query to filter by training to match what would be produced by the searchBar so that the evaluate panel updates the label correctly. f309d691dfabbd84d1d381d8602522b756a336b7

@@ -167,6 +167,7 @@ export interface DataFrameAnalyticsExplorationQueryState {
ml: {
jobId: JobId;
analysisType: DataFrameAnalysisConfigType;
isTraining?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

should it be a boolean instead? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, good catch. Updated so param is always a boolean. 43a33e33877d0893f3f0041df1c7240c1df45860

@@ -52,7 +52,7 @@ export const ExplorationQueryBar: FC<ExplorationQueryBarProps> = ({
if (defaultQueryString !== undefined) {
setSearchInput({ query: defaultQueryString, language: SEARCH_QUERY_LANGUAGE.KUERY });
}
}, []);
}, [defaultQueryString !== undefined]);
Copy link
Contributor

Choose a reason for hiding this comment

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

do you need to perform this check on every update?

Copy link
Contributor Author

@alvarezmelissa87 alvarezmelissa87 Sep 24, 2020

Choose a reason for hiding this comment

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

This check is required since defaultQueryString will be undefined on first render. I only need it to update once it has a value and then never again.

Comment on lines 35 to 39
isTraining?: string | boolean;
}> = ({ jobId, analysisType, isTraining }) => {
if (isTraining !== undefined) {
isTraining = isTraining === 'true';
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think isTraining should always come here as a boolean

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed - updated to always be a boolean 43a33e33877d0893f3f0041df1c7240c1df45860

@darnautov
Copy link
Contributor

TBH I'm not in favor of this implementation using a default query approach. I believe the URL sate should always be a source of truth. At the moment when the user manually changes the query in the search bar, it doesn't persist in the URL state.
Instead, I would update the URL state based on query changes. So the user writes down some query, get a bookmarkable link, and share it with someone. It will also allow filtering on any field, not just isTraining

@alvarezmelissa87
Copy link
Contributor Author

alvarezmelissa87 commented Sep 24, 2020

@darnautov - thanks for taking a look! This is the first step in implementation to unblock the work for the models list. I agree that persisting results view filters in the URL so they can be shared could be very useful but it seems out of scope for this piece of work.

Regarding defaultIsTraining - as it is meant to be a default when you get onto the page - it would make sense to clear it out of the URL. It would also make it more clear that the query is not currently being persisted in the url. So I can go ahead and make that change.

@alvarezmelissa87 alvarezmelissa87 force-pushed the ml-dfanalytics-results-improvements branch from f309d69 to 6e19a53 Compare September 24, 2020 15:19
@alvarezmelissa87
Copy link
Contributor Author

This has been updated with suggested changes and I've made the description clearer. Ready for another look when you get a chance. cc @darnautov, @peteharverson

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested and LGTM.

The example you give in the PR description needs amending to use defaultIsTraining:!t rather than isTraining:!t I think.

@alvarezmelissa87 alvarezmelissa87 force-pushed the ml-dfanalytics-results-improvements branch from 43a33e3 to 907a789 Compare September 28, 2020 17:06
@alvarezmelissa87 alvarezmelissa87 changed the title [ML]DF Analytics exploration: default filter of results page by isTraining value in url [ML]DF Analytics exploration: default filter of results page by defaultIsTraining value in url Sep 28, 2020
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id value diff baseline
ml 8.9MB +2.6KB 8.9MB

page load bundle size

id value diff baseline
ml 734.8KB +653.0B 734.1KB

History

  • 💚 Build #77104 succeeded 43a33e33877d0893f3f0041df1c7240c1df45860
  • 💚 Build #76980 succeeded 6e19a5339356dde3ccbc2373aef2db2500a41788
  • 💚 Build #76688 succeeded f309d691dfabbd84d1d381d8602522b756a336b7
  • 💚 Build #76554 succeeded 158495b5b59c7e4000ef895d68232876cbe39386

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@alvarezmelissa87 alvarezmelissa87 merged commit 25682bf into elastic:master Sep 28, 2020
alvarezmelissa87 added a commit to alvarezmelissa87/kibana that referenced this pull request Sep 28, 2020
…ultIsTraining` value in url (elastic#78303)

* df exploration page: handle default isTraining filter in url

* default training query updated to match what the searchBar would produce. fixes evaluate panel dataset label

* clear defaultIsTraining filter from url once applied
@alvarezmelissa87 alvarezmelissa87 deleted the ml-dfanalytics-results-improvements branch September 28, 2020 19:17
alvarezmelissa87 added a commit that referenced this pull request Sep 28, 2020
…ultIsTraining` value in url (#78303) (#78670)

* df exploration page: handle default isTraining filter in url

* default training query updated to match what the searchBar would produce. fixes evaluate panel dataset label

* clear defaultIsTraining filter from url once applied
phillipb added a commit to phillipb/kibana that referenced this pull request Sep 29, 2020
…a into add-anomalies-to-timeline

* 'add-anomalies-to-timeline' of github.com:phillipb/kibana: (89 commits)
  Aligns several module versions across the repository (elastic#78327)
  Empty prompt and loading spinner for service map (elastic#78382)
  Change progress bar to spinner (elastic#78460)
  [QA][Code Coverage] Coverage teams lookup w/o Additional Config (elastic#77111)
  Slim down core bundle (elastic#75912)
  [Alerting] retry internal OCC calls within alertsClient (elastic#77838)
  [kbn/optimizer] only build xpack examples when building xpack plugins (elastic#78656)
  [Ingest Manager] Ingest setup upgrade (elastic#78081)
  [Ingest Manager] Surface saved object client 10,000 limitation to bulk actions UI (elastic#78520)
  fix name without a category or if field end with .text (elastic#78655)
  [Security Solution] [Detections] Log message enhancements (elastic#78429)
  [ML]DF Analytics exploration: default filter of results page by `defaultIsTraining` value in url (elastic#78303)
  [Enterprise Search] Remove all instances of KibanaContext to Kea store (elastic#78513)
  [ML] DF Analytics creation: ensure job did not fail to start before showing results link (elastic#78200)
  fix createAppNavigationHandler to use `navigateToUrl` (elastic#78583)
  Fixing a11y test failure on discover app (elastic#59975) (elastic#77614)
  [Security Solution] Initiate endpoint package upgrade from security app (elastic#77498)
  [kbn/es] use a basic build process (elastic#78090)
  [kbn/optimizer] fix .json extension handling (elastic#78524)
  Fix APM lodash imports (elastic#78438)
  ...
gmmorris added a commit to gmmorris/kibana that referenced this pull request Sep 29, 2020
* master: (365 commits)
  making expression debug info serializable (elastic#78727)
  fix lodahs imports in app-arch code (elastic#78582)
  Make Field a React.lazy export (elastic#78483)
  [Security Solution] Improves detections tests (elastic#77295)
  [TSVB] Different field format on different series is ignored (elastic#78138)
  RFC: Improve saved object migrations (elastic#66056)
  [Security Solution] Fixes url timeline flaky test (elastic#78556)
  adds retryability feature (elastic#78611)
  Aligns several module versions across the repository (elastic#78327)
  Empty prompt and loading spinner for service map (elastic#78382)
  Change progress bar to spinner (elastic#78460)
  [QA][Code Coverage] Coverage teams lookup w/o Additional Config (elastic#77111)
  Slim down core bundle (elastic#75912)
  [Alerting] retry internal OCC calls within alertsClient (elastic#77838)
  [kbn/optimizer] only build xpack examples when building xpack plugins (elastic#78656)
  [Ingest Manager] Ingest setup upgrade (elastic#78081)
  [Ingest Manager] Surface saved object client 10,000 limitation to bulk actions UI (elastic#78520)
  fix name without a category or if field end with .text (elastic#78655)
  [Security Solution] [Detections] Log message enhancements (elastic#78429)
  [ML]DF Analytics exploration: default filter of results page by `defaultIsTraining` value in url (elastic#78303)
  ...
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.

6 participants