[SPARK-57957][ML][TESTS] Deflake GaussianMixtureSuite 'GMM support instance weighting' on macOS using well-posed data#57035
Closed
HyukjinKwon wants to merge 1 commit into
Conversation
…stance weighting' on macOS using well-posed data ### What changes were proposed in this pull request? Change the `GMM support instance weighting` test to fit `rDataset` with `k=2` instead of fitting `k=5` on `KMeansSuite.generateKMeansData(50, 3, 5)`. ### Why are the changes needed? The generated KMeans data is 5 clusters of identical points (zero within-cluster variance). Fitting k=5 Gaussians makes the covariances singular and the EM fit ill-posed, so the uniform-weighted and unweighted fits converge to different component-collapse patterns. On the macOS-26 runner (`build_maven_java21_macos26`) this deterministically fails the mixture-weight comparison (0.0197 vs 0.1047). Reducing the instance weight (as in SPARK-37317) and increasing maxIter were both verified on macOS-26 to NOT help (maxIter makes a component collapse further, 7.6e-11 vs 0.116). Running the same unweighted==uniform-weighted invariant on well-posed data (`rDataset`, real variance, k=2 - already used stably by another test in this suite) makes both fits converge to the same optimum. Verified green on a macOS-26 runner. ### Does this PR introduce _any_ user-facing change? No, test-only. ### How was this patch tested? Ran GaussianMixtureSuite on a macOS-26 GitHub Actions runner: 13 succeeded, 0 failed (previously the instance-weighting test failed deterministically on macOS-26). ### Was this patch authored or co-authored using generative AI tooling? Yes. This pull request and its description were written by Isaac.
zhengruifeng
approved these changes
Jul 6, 2026
HyukjinKwon
added a commit
that referenced
this pull request
Jul 6, 2026
…tance weighting' on macOS using well-posed data ### What changes were proposed in this pull request? Change the `GMM support instance weighting` test to fit `rDataset` with `k=2` instead of fitting `k=5` on `KMeansSuite.generateKMeansData(50, 3, 5)`. ### Why are the changes needed? The generated KMeans data is 5 clusters of identical points (zero within-cluster variance). Fitting k=5 Gaussians makes the covariances singular and the EM fit ill-posed, so the uniform-weighted and unweighted fits converge to different component-collapse patterns. On the macOS-26 runner (`build_maven_java21_macos26`) this deterministically fails the mixture-weight comparison (0.0197 vs 0.1047). Reducing the instance weight (as in SPARK-37317, which reduced 100->90) and increasing maxIter were both verified on a macOS-26 runner to NOT help — increasing maxIter actually makes a component collapse further (7.6e-11 vs 0.116). Running the same `unweighted == uniform-weighted` invariant on well-posed data (`rDataset`, real variance, `k=2` — already used stably by another test in this suite) makes both fits converge to the same optimum. ### Does this PR introduce _any_ user-facing change? No, test-only. ### How was this patch tested? `GaussianMixtureSuite` on a macOS-26 GitHub Actions runner. - **Before (failing on `apache/spark` macOS-26, `build_maven_java21_macos26`):** https://github.com/apache/spark/actions/runs/28753698265/job/85259893661 — `GMM support instance weighting *** FAILED ***`, `Expected 0.01972564065075309 and 0.10476714410584831 to be within 0.001`. - **After (passing with this change, macOS-26 runner):** https://github.com/HyukjinKwon/spark-agent6/actions/runs/28773420633/job/85311928908 — `GaussianMixtureSuite: Tests: succeeded 13, failed 0`, `All tests passed.` Also passes on Linux. ### Was this patch authored or co-authored using generative AI tooling? Yes. This pull request and its description were written by Isaac. Closes #57035 from HyukjinKwon/ci-fix/agent5-gmm-macos-wellposed. Authored-by: Hyukjin Kwon <gurwls223@apache.org> Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com> (cherry picked from commit 0a6bbee) Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com>
HyukjinKwon
added a commit
that referenced
this pull request
Jul 6, 2026
…tance weighting' on macOS using well-posed data ### What changes were proposed in this pull request? Change the `GMM support instance weighting` test to fit `rDataset` with `k=2` instead of fitting `k=5` on `KMeansSuite.generateKMeansData(50, 3, 5)`. ### Why are the changes needed? The generated KMeans data is 5 clusters of identical points (zero within-cluster variance). Fitting k=5 Gaussians makes the covariances singular and the EM fit ill-posed, so the uniform-weighted and unweighted fits converge to different component-collapse patterns. On the macOS-26 runner (`build_maven_java21_macos26`) this deterministically fails the mixture-weight comparison (0.0197 vs 0.1047). Reducing the instance weight (as in SPARK-37317, which reduced 100->90) and increasing maxIter were both verified on a macOS-26 runner to NOT help — increasing maxIter actually makes a component collapse further (7.6e-11 vs 0.116). Running the same `unweighted == uniform-weighted` invariant on well-posed data (`rDataset`, real variance, `k=2` — already used stably by another test in this suite) makes both fits converge to the same optimum. ### Does this PR introduce _any_ user-facing change? No, test-only. ### How was this patch tested? `GaussianMixtureSuite` on a macOS-26 GitHub Actions runner. - **Before (failing on `apache/spark` macOS-26, `build_maven_java21_macos26`):** https://github.com/apache/spark/actions/runs/28753698265/job/85259893661 — `GMM support instance weighting *** FAILED ***`, `Expected 0.01972564065075309 and 0.10476714410584831 to be within 0.001`. - **After (passing with this change, macOS-26 runner):** https://github.com/HyukjinKwon/spark-agent6/actions/runs/28773420633/job/85311928908 — `GaussianMixtureSuite: Tests: succeeded 13, failed 0`, `All tests passed.` Also passes on Linux. ### Was this patch authored or co-authored using generative AI tooling? Yes. This pull request and its description were written by Isaac. Closes #57035 from HyukjinKwon/ci-fix/agent5-gmm-macos-wellposed. Authored-by: Hyukjin Kwon <gurwls223@apache.org> Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com> (cherry picked from commit 0a6bbee) Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com>
HyukjinKwon
added a commit
that referenced
this pull request
Jul 6, 2026
…tance weighting' on macOS using well-posed data ### What changes were proposed in this pull request? Change the `GMM support instance weighting` test to fit `rDataset` with `k=2` instead of fitting `k=5` on `KMeansSuite.generateKMeansData(50, 3, 5)`. ### Why are the changes needed? The generated KMeans data is 5 clusters of identical points (zero within-cluster variance). Fitting k=5 Gaussians makes the covariances singular and the EM fit ill-posed, so the uniform-weighted and unweighted fits converge to different component-collapse patterns. On the macOS-26 runner (`build_maven_java21_macos26`) this deterministically fails the mixture-weight comparison (0.0197 vs 0.1047). Reducing the instance weight (as in SPARK-37317, which reduced 100->90) and increasing maxIter were both verified on a macOS-26 runner to NOT help — increasing maxIter actually makes a component collapse further (7.6e-11 vs 0.116). Running the same `unweighted == uniform-weighted` invariant on well-posed data (`rDataset`, real variance, `k=2` — already used stably by another test in this suite) makes both fits converge to the same optimum. ### Does this PR introduce _any_ user-facing change? No, test-only. ### How was this patch tested? `GaussianMixtureSuite` on a macOS-26 GitHub Actions runner. - **Before (failing on `apache/spark` macOS-26, `build_maven_java21_macos26`):** https://github.com/apache/spark/actions/runs/28753698265/job/85259893661 — `GMM support instance weighting *** FAILED ***`, `Expected 0.01972564065075309 and 0.10476714410584831 to be within 0.001`. - **After (passing with this change, macOS-26 runner):** https://github.com/HyukjinKwon/spark-agent6/actions/runs/28773420633/job/85311928908 — `GaussianMixtureSuite: Tests: succeeded 13, failed 0`, `All tests passed.` Also passes on Linux. ### Was this patch authored or co-authored using generative AI tooling? Yes. This pull request and its description were written by Isaac. Closes #57035 from HyukjinKwon/ci-fix/agent5-gmm-macos-wellposed. Authored-by: Hyukjin Kwon <gurwls223@apache.org> Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com> (cherry picked from commit 0a6bbee) Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com>
HyukjinKwon
added a commit
that referenced
this pull request
Jul 6, 2026
…tance weighting' on macOS using well-posed data ### What changes were proposed in this pull request? Change the `GMM support instance weighting` test to fit `rDataset` with `k=2` instead of fitting `k=5` on `KMeansSuite.generateKMeansData(50, 3, 5)`. ### Why are the changes needed? The generated KMeans data is 5 clusters of identical points (zero within-cluster variance). Fitting k=5 Gaussians makes the covariances singular and the EM fit ill-posed, so the uniform-weighted and unweighted fits converge to different component-collapse patterns. On the macOS-26 runner (`build_maven_java21_macos26`) this deterministically fails the mixture-weight comparison (0.0197 vs 0.1047). Reducing the instance weight (as in SPARK-37317, which reduced 100->90) and increasing maxIter were both verified on a macOS-26 runner to NOT help — increasing maxIter actually makes a component collapse further (7.6e-11 vs 0.116). Running the same `unweighted == uniform-weighted` invariant on well-posed data (`rDataset`, real variance, `k=2` — already used stably by another test in this suite) makes both fits converge to the same optimum. ### Does this PR introduce _any_ user-facing change? No, test-only. ### How was this patch tested? `GaussianMixtureSuite` on a macOS-26 GitHub Actions runner. - **Before (failing on `apache/spark` macOS-26, `build_maven_java21_macos26`):** https://github.com/apache/spark/actions/runs/28753698265/job/85259893661 — `GMM support instance weighting *** FAILED ***`, `Expected 0.01972564065075309 and 0.10476714410584831 to be within 0.001`. - **After (passing with this change, macOS-26 runner):** https://github.com/HyukjinKwon/spark-agent6/actions/runs/28773420633/job/85311928908 — `GaussianMixtureSuite: Tests: succeeded 13, failed 0`, `All tests passed.` Also passes on Linux. ### Was this patch authored or co-authored using generative AI tooling? Yes. This pull request and its description were written by Isaac. Closes #57035 from HyukjinKwon/ci-fix/agent5-gmm-macos-wellposed. Authored-by: Hyukjin Kwon <gurwls223@apache.org> Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com> (cherry picked from commit 0a6bbee) Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com>
HyukjinKwon
added a commit
that referenced
this pull request
Jul 6, 2026
…tance weighting' on macOS using well-posed data ### What changes were proposed in this pull request? Change the `GMM support instance weighting` test to fit `rDataset` with `k=2` instead of fitting `k=5` on `KMeansSuite.generateKMeansData(50, 3, 5)`. ### Why are the changes needed? The generated KMeans data is 5 clusters of identical points (zero within-cluster variance). Fitting k=5 Gaussians makes the covariances singular and the EM fit ill-posed, so the uniform-weighted and unweighted fits converge to different component-collapse patterns. On the macOS-26 runner (`build_maven_java21_macos26`) this deterministically fails the mixture-weight comparison (0.0197 vs 0.1047). Reducing the instance weight (as in SPARK-37317, which reduced 100->90) and increasing maxIter were both verified on a macOS-26 runner to NOT help — increasing maxIter actually makes a component collapse further (7.6e-11 vs 0.116). Running the same `unweighted == uniform-weighted` invariant on well-posed data (`rDataset`, real variance, `k=2` — already used stably by another test in this suite) makes both fits converge to the same optimum. ### Does this PR introduce _any_ user-facing change? No, test-only. ### How was this patch tested? `GaussianMixtureSuite` on a macOS-26 GitHub Actions runner. - **Before (failing on `apache/spark` macOS-26, `build_maven_java21_macos26`):** https://github.com/apache/spark/actions/runs/28753698265/job/85259893661 — `GMM support instance weighting *** FAILED ***`, `Expected 0.01972564065075309 and 0.10476714410584831 to be within 0.001`. - **After (passing with this change, macOS-26 runner):** https://github.com/HyukjinKwon/spark-agent6/actions/runs/28773420633/job/85311928908 — `GaussianMixtureSuite: Tests: succeeded 13, failed 0`, `All tests passed.` Also passes on Linux. ### Was this patch authored or co-authored using generative AI tooling? Yes. This pull request and its description were written by Isaac. Closes #57035 from HyukjinKwon/ci-fix/agent5-gmm-macos-wellposed. Authored-by: Hyukjin Kwon <gurwls223@apache.org> Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com> (cherry picked from commit 0a6bbee) Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com>
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Change the
GMM support instance weightingtest to fitrDatasetwithk=2instead of fittingk=5onKMeansSuite.generateKMeansData(50, 3, 5).Why are the changes needed?
The generated KMeans data is 5 clusters of identical points (zero within-cluster variance). Fitting k=5 Gaussians makes the covariances singular and the EM fit ill-posed, so the uniform-weighted and unweighted fits converge to different component-collapse patterns. On the macOS-26 runner (
build_maven_java21_macos26) this deterministically fails the mixture-weight comparison (0.0197 vs 0.1047).Reducing the instance weight (as in SPARK-37317, which reduced 100->90) and increasing maxIter were both verified on a macOS-26 runner to NOT help — increasing maxIter actually makes a component collapse further (7.6e-11 vs 0.116). Running the same
unweighted == uniform-weightedinvariant on well-posed data (rDataset, real variance,k=2— already used stably by another test in this suite) makes both fits converge to the same optimum.Does this PR introduce any user-facing change?
No, test-only.
How was this patch tested?
GaussianMixtureSuiteon a macOS-26 GitHub Actions runner.apache/sparkmacOS-26,build_maven_java21_macos26): https://github.com/apache/spark/actions/runs/28753698265/job/85259893661 —GMM support instance weighting *** FAILED ***,Expected 0.01972564065075309 and 0.10476714410584831 to be within 0.001.GaussianMixtureSuite: Tests: succeeded 13, failed 0,All tests passed.Also passes on Linux.
Was this patch authored or co-authored using generative AI tooling?
Yes.
This pull request and its description were written by Isaac.