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

Similarity UDF #535

Merged
merged 27 commits into from
Dec 19, 2022
Merged

Similarity UDF #535

merged 27 commits into from
Dec 19, 2022

Conversation

jiashenC
Copy link
Member

Similarity UDF

  • Compare distance between feature from open and base feature and return the calculated distance.

eva/udfs/ndarray/similarity.py Outdated Show resolved Hide resolved
eva/expression/function_expression.py Show resolved Hide resolved
eva/executor/orderby_executor.py Show resolved Hide resolved
row.iloc[1],
)

# Transform to 2D.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to do this transformation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Faiss only accepts a 2D array, so I am doing this transformation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, we should think about enforcing it in the binder. If it requires a lot of effort, we can skip it for now but add a comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. In this case, if the shape is not 2D (e.g., the feature vector output from the feature extractor), who will take the responsibility to convert it to 2D? The similarity UDF or something else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it standard practice to convert the feature vector to 2D for similarity? I was thinking of reporting it as an error to the user, and they will fix it. But if you think it is standard practise, I'm fine with it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will leave a comment for this and we can think about improving this later.

For your approach, if we instead of asking users to take care the transformation, they will probably need another UDF just for reshaping?

Copy link
Member

@gaurav274 gaurav274 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor Comments
LGTM

@jiashenC jiashenC merged commit 4933d89 into master Dec 19, 2022
@jiashenC jiashenC deleted the similarity-fe branch December 19, 2022 16:27
This was referenced Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants