Skip to content

Frustrated with figuring out SPTAG #61

@shashi-netra

Description

@shashi-netra

I have been trying to figure SPTAG out to use in my ANN searches to no avail. I am not getting an responses from the contributors, so am trying my luck with other uses. Could someone provide a simple walkthrough of how to use this tool? This is what I am stuck on:

  1. If i want to create a 300 dimension store, I need to a "build" first? and is this done only once?
n = 300
k = 5
r = 3
def testBuild(algo, distmethod, x, out):
   i = SPTAG.AnnIndex(algo, 'Float', x.shape[1])
   i.SetBuildParam("NumberOfThreads", '4')
   i.SetBuildParam("DistCalcMethod", distmethod)
   ret = i.Build(x, x.shape[0])
   i.Save(out)
  1. For incremental adds, do I just use this method without overwriting previous ones:
def testAdd(index, x, out, algo, distmethod):
   if index != None:
       i = SPTAG.AnnIndex.Load(index)
   else:
       i = SPTAG.AnnIndex(algo, 'Float', x.shape[1])
   i.SetBuildParam("NumberOfThreads", '4')
   i.SetBuildParam("DistCalcMethod", distmethod)
   if i.Add(x, x.shape[0]):
       i.Save(out)
  1. what does the testAddWithMetaData do? does it return say an identifier with each result it returns? Is there a type of metadata that is supported i.e. can i save text snippets with it?

Could someone from microsoft please take a moment to provide a simple guide to using this powerful tool?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions