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

Fix ee.List.shuffle #6

Closed
aazuspan opened this issue Nov 6, 2022 · 0 comments · Fixed by #7
Closed

Fix ee.List.shuffle #6

aazuspan opened this issue Nov 6, 2022 · 0 comments · Fixed by #7
Labels
bug Something isn't working

Comments

@aazuspan
Copy link
Owner

aazuspan commented Nov 6, 2022

ee.List.shuffle(seed=False) returns non-deterministic results from the same invocation, which means that equality checks on server side objects incorrectly pass causing false-positive cache hits. You can easily confirm this with:

l = ee.List.sequence(1, 10)

l.shuffle(seed=False) == l.shuffle(seed=False) # True
l.shuffle(seed=False).getInfo() == l.shuffle(seed=False).getInfo() # False

Repeated calls will generate different results but hit the same cache, displaying the wrong data. This will affect lists and anything generated from shuffled lists, e.g. a FeatureCollection generated from a list of coordinates.

To fix this, I'll need to add a function that parses each Earth Engine object's invocation string (just get the string repr for the object) and prevents caching if List.shuffle is found.

I've tested every other Earth Engine method that takes a random seed, and this is the only one that acts non-deterministically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant