-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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] Fix sampling probability when switching between automatic and manual #150389
Conversation
Pinging @elastic/ml-ui (:ml) |
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.
Tested locally and could still produce the result described in #146323 with slightly extended steps:
- Open an index in the data visualizer
- In the random sampler popover switch to
On - manual
- here was the original issue and this is now working fine: displays
50%
/50
- here was the original issue and this is now working fine: displays
- Select a different percentage, e.g.
25%
- Switch the random sampling to
Off
- Switch the random sampling to
On - manual
again- => the percentage is set to
50%
and the label displays100
- => the percentage is set to
Some early feedback on using the range slider with the combined input - I like the potential the input provides for allowing more fine-grained control at the lower end of the scale (% less than 5).
|
Thanks for the feedback. I have updated the slider & numerical input to allow any value between 0.001% to 50%. I also added an Screen.Recording.2023-02-08.at.17.56.37.movOtherwise, for the first time switching from |
const isInvalidSamplingProbabilityInput = | ||
!isDefined(samplingProbabilityInput) || | ||
isNaN(samplingProbabilityInput) || | ||
samplingProbabilityInput <= 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.
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.
Thanks for catching that. Fixed here 9dcd987
(#150389)
const prevValue = samplingProbabilityInput ? samplingProbabilityInput * 100 : value; | ||
|
||
if (value > 0 && value <= 1) { | ||
setSamplingProbabilityInput(value / 100); |
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.
Thanks for catching that. Updated here 9dcd987
(#150389)
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 looks good. Left a couple of comments.
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.
Tested latest changes and LGTM.
@pheyos Thanks for catching that. Looks like it was an issue with the EUI show ticks & inputWithPopover setting. I've updated it to show the range on the two sides instead. |
@qn895 Tested the latest changes locally and the above mentioned issue didn't occur anymore.
Not sure if this is something we want to address at all and if we want to address it as part of this PR. |
@pheyos This seems to be an issue with EUI. If it's not a blocker, I think we can address this later. |
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, left just a small suggestion on possibly restructuring component nesting.
@@ -139,6 +118,18 @@ export const DocumentCountContent: FC<Props> = ({ | |||
</div> | |||
) : null; | |||
|
|||
const CalculatingProbMessage = |
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: Suggest to make ProbabilityUsedMessage
and CalculatingProbMessage
React components on the outer level and not within that component.
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.
Updated here 1d0e2a6
(#150389)
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
As discussed above, we can look into the slider behavior separately.
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @qn895 |
…nual (elastic#150389) (cherry picked from commit 7fe8154)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…and manual (#150389) (#151182) # Backport This will backport the following commits from `main` to `8.7`: - [[ML] Fix sampling probability when switching between automatic and manual (#150389)](#150389) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Quynh Nguyen (Quinn)","email":"43350163+qn895@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-02-14T17:09:33Z","message":"[ML] Fix sampling probability when switching between automatic and manual (#150389)","sha":"7fe81548b3272b35d63b498e17188b9c56b1022a","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Feature:File and Index Data Viz","v8.7.0","v8.8.0"],"number":150389,"url":"#150389 Fix sampling probability when switching between automatic and manual (#150389)","sha":"7fe81548b3272b35d63b498e17188b9c56b1022a"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"#150389 Fix sampling probability when switching between automatic and manual (#150389)","sha":"7fe81548b3272b35d63b498e17188b9c56b1022a"}}]}] BACKPORT--> Co-authored-by: Quynh Nguyen (Quinn) <43350163+qn895@users.noreply.github.com>
Summary
This PR fixes #146323 and addresses wrong initial label on sampling percentage slider. Change involves setting switching the EuiSlider to EuiSelect with 100% as the a new option. This means when switching from
On - automatic
orOff
(where both are at 100%), switching toOn - manual
will by default switch to 0.001%.Checklist
Delete any items that are not applicable to this PR.