Your question is Custom Similarity Search for Vectors. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Write a function to implement a custom similarity search algorithm for high-dimensional vectors. Implement seeded random-hyperplane locality-sensitive hashing, probe each query bucket and its one-bit neighbors, then rank candidates by cosine similarity. Return up to k original vector indices, ordered by decreasing similarity and increasing index for ties. If fewer than k candidates are found, rank all vectors. Zero vectors have similarity 1 to another zero vector and 0 to any nonzero vector.
Input/output: vectors and query are numeric lists, while k, num_tables, num_planes, and seed are integers. Return a list of indices.
def similarity_search(vectors, query, k, num_tables, num_planes, seed):