-
Notifications
You must be signed in to change notification settings - Fork 267
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
Bug: Jaccard UDF giving incorrect results in some cases #383
Labels
bug
Something isn't working
Comments
It might be possible to further optimize and generalize this function to arrays of any types, rather than just strings by casting it in SQL
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found a bug in the the Jaccard distance function https://github.com/GoogleCloudPlatform/bigquery-utils/blob/master/udfs/community/jaccard.sqlx (the function below is a copy of the Jaccard UDF, cast as a TEMP FUNCTION)
This should give 2/3 = 0.667 (since here there the intersection is size 2, and the union is size 3), but instead gives 0.25.
I believe the bug can be fixed by replacing
with
With the current version of these lengths, the array indices become out of bounds.
The text was updated successfully, but these errors were encountered: