Skip to main content

๐Ÿ‘ Changing the similarity metric

The similarity metric determines how nearest neighbors are calculated, and consequently what items are retrieved during vector search.

To change the similarity metric for vector search, you just need to update the similarity field in the vector search index definition.

Fill in any <CODE_BLOCK_N> placeholders and run the cells under the Step 8: Changing the similarity metric section in the notebook to experiment with a different similarity metric for vector search.

The answers for code blocks in this section are as follows:

CODE_BLOCK_16

Answer
{
"name": ATLAS_VECTOR_SEARCH_INDEX_NAME,
"type": "vectorSearch",
"definition": {
"fields": [
{
"type": "vector",
"path": "embedding",
"numDimensions": 512,
"similarity": "dotProduct",
},
]
},
}