Skip to content

[Not an issue] Curious on Distance Calculation #22

@firmanjml

Description

@firmanjml

Hi, thank you for sharing this project, it’s an excellent resource for the community to learn from.

I just have a quick question (this isn’t an issue report).
I noticed that you're using ObjectBox to store vectors, and I came across a function in your code.

cosineDistance(x1: FloatArray, x2: FloatArray) {}

Since ObjectBox provides a built-in nearestNeighbour function that can be used with cosine distance to determine vector similarity, I'm wondering...

Is it necessary to use the cosineDistance function again after calling nearestNeighbour?
From what I understand, nearestNeighbour already handles the cosine distance calculation to find the most similar vectors.

Objectbox Data Model & Vector Index
VectorDistanceType COSINE
consineDistance function ln 113

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions