microsoft / microsoft/SPTAG

Frustrated with figuring out SPTAG

Open
#61 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
C++
Stars
5k
Forks
622
Avg merge
8h 37m
Merged PRs (30d)
5

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Python API examples in the issue, especially AnnIndex.Build, Add, Save, Load, and testAddWithMetaData. Produce a simple walkthrough that explains initial builds, incremental additions, and metadata results, including whether text snippets are supported and how identifiers are returned.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
backend, data
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.