Skip to content

Conversation

@lbh930
Copy link

@lbh930 lbh930 commented Nov 21, 2025

Description

This PR fixes non-deterministic test flakiness in TestClassificationEnsembles by stabilizing HashMap iteration order during feature map assertions. The fix adds a sortFeatures() helper method to sort feature maps before comparison.

Motivation

This change is necessary to eliminate test flakiness caused by HashMap's non-deterministic iteration order in feature maps returned by getTopFeatures(). This is a bug fix that ensures test stability without modifying any production code. The fix is verified using NonDex.

Paper reference

N/A

@oracle-contributor-agreement
Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Nov 21, 2025
@Craigacp
Copy link
Member

What's the stack trace you get from a test failure here? The features map isn't probed by the test methods, just tested that it exists and is not empty.

@oracle-contributor-agreement
Copy link

Thank you for signing the OCA.

@oracle-contributor-agreement oracle-contributor-agreement bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels Nov 21, 2025
@Craigacp
Copy link
Member

Running nondex on this test gives me a different error which looks like it's something to do with the same kind of issue in the CART implementation (i.e. in AdaboostTrainer there are multiple locations which compute the feature id maps and these end up out of sync running under nondex). Unfortunately I only have a partial fix for the root cause it at the moment, so I need to work on it some more.

@Craigacp
Copy link
Member

Craigacp commented Dec 1, 2025

Should this be closed in favour of #424?

@lbh930
Copy link
Author

lbh930 commented Dec 1, 2025

@Craigacp I think so, I just verified with NonDex that #424 fixes this test too. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants