Code Monkey home page Code Monkey logo

n2's Introduction

N2

Latest Version Documentation Status Build Status Apache-License 2.0

Lightweight approximate Nearest Neighbor algorithm library written in C++ (with Python/Go bindings).

N2 stands for two N's, which comes from 'Approximate Nearest Neighbor Algorithm'.

Why N2 Was Made

Before N2, there has been other great approximate nearest neighbor libraries such as Annoy and NMSLIB. However, each of them had different strengths and weaknesses regarding usability, performance, and etc. So, N2 has been developed aiming to bring the strengths of existing aKNN libraries and supplement their weaknesses.

Features

  • Lightweight library which runs fast with large datasets.
  • Good performance in terms of index build time, search speed, and memory usage.
  • Supports multi-core CPUs for index building.
  • Supports a mmap feature by default to efficiently process large index files.
  • Supports Python/Go bindings.

Supported Distance Metrics

Metric Definition d(p, q)
"angular" 1 - cosθ 1 - {sum(p i · q i) / sqrt(sum(p i · p i) · sum(q i · q i))}
"L2" squared L2 sum{(p i - q i) 2}
"dot" dot product sum(p i · q i)

N2 supports three distance metrics. For "angular" and "L2", d (distance) is defined such that the closer the vectors are, the smaller d is. However for "dot", d is defined such that the closer the vectors are, the larger d is. You may be wondering why we defined and implemented "dot" metric as plain dot product and not as (1 - dot product). The rationale for this decision was to allow users to directly interpret the d value returned from Hnsw search function as a dot product value.

Quickstart

  1. Install N2 with pip.
$ pip install n2
  1. Here is a python code snippet demonstrating how to use N2.
import numpy as np

from n2 import HnswIndex

N, dim = 10240, 20
samples = np.arange(N * dim).reshape(N, dim)

index = HnswIndex(dim)
for sample in samples:
    index.add_data(sample)
index.build(m=5, n_threads=4)
print(index.search_by_id(0, 10))
# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Full Documentation

Visit n2.readthedocs.io for full documentation. The documentation site explains the following contents in detail.

Performance

  • Here are the results of our benchmark experiments.
  • You can also see benchmarks of various ANN libraries in Python at ann-benchmarks.com. Note that N2 version 0.1.6 is used in ann-benchmarks.com (last checked on October 8th, 2020) and we are continuing our efforts to improve N2 performance.

Index Build Time

image0

Search Speed

image1

Memory Usage

image2

References

License

This software is licensed under the Apache 2 license, quoted below.

Copyright 2017 Kakao Corp. http://www.kakaocorp.com

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

n2's People

Contributors

chiwanpark avatar coder-mina avatar corona10 avatar cynthia avatar gony-noreply avatar heekyungyoon avatar ita9naiwa avatar js1010 avatar kakao-eli-kim avatar kn-slyr avatar oss-kakao avatar ummae avatar zsaladin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

n2's Issues

Can't install into Conda environment on macOS Big Sur

I am getting this when I try to install n2 in a condo environment on macOS 11.0.1.

(Standard) jobha@macbook-pro ~ % pip install n2
Defaulting to user installation because normal site-packages is not writeable
Collecting n2
  Using cached n2-0.1.7.tar.gz (8.6 MB)
Requirement already satisfied: cython in ./Library/Python/3.8/lib/python/site-packages (from n2) (0.29.21)
Building wheels for collected packages: n2
  Building wheel for n2 (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/setup.py'"'"'; __file__='"'"'/private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-wheel-yyl4o763
       cwd: /private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/
  Complete output (17 lines):
  running bdist_wheel
  running build
  running build_ext
  cythoning ./bindings/python/n2.pyx to ./bindings/python/n2.cpp
  /Users/jobha/Library/Python/3.8/lib/python/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/bindings/python/n2.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  building 'n2' extension
  creating build
  creating build/temp.macosx-10.14.6-x86_64-3.8
  creating build/temp.macosx-10.14.6-x86_64-3.8/src
  creating build/temp.macosx-10.14.6-x86_64-3.8/bindings
  creating build/temp.macosx-10.14.6-x86_64-3.8/bindings/python
  /usr/local/opt/gcc/bin/gcc-10 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -I./include/ -I./third_party/spdlog/include/ -I./third_party/eigen -Ithird_party/boost/assert/include/ -Ithird_party/boost/bind/include/ -Ithird_party/boost/concept_check/include/ -Ithird_party/boost/config/include/ -Ithird_party/boost/core/include/ -Ithird_party/boost/detail/include/ -Ithird_party/boost/heap/include/ -Ithird_party/boost/iterator/include/ -Ithird_party/boost/mp11/include/ -Ithird_party/boost/mpl/include/ -Ithird_party/boost/parameter/include/ -Ithird_party/boost/preprocessor/include/ -Ithird_party/boost/static_assert/include/ -Ithird_party/boost/throw_exception/include/ -Ithird_party/boost/type_traits/include/ -Ithird_party/boost/utility/include/ -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c ./src/heuristic.cc -o build/temp.macosx-10.14.6-x86_64-3.8/./src/heuristic.o -std=c++14 -O3 -fPIC -march=native -DNDEBUG -DBOOST_DISABLE_ASSERTS -fopenmp
  gcc-10: error: this compiler does not support arm64
  gcc-10: error: unrecognized command-line option '-iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders'
  gcc-10: error: unrecognized command-line option '-iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers'
  error: command '/usr/local/opt/gcc/bin/gcc-10' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for n2
  Running setup.py clean for n2
Failed to build n2
Installing collected packages: n2
    Running setup.py install for n2 ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/setup.py'"'"'; __file__='"'"'/private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-record-7pd04cpp/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/jobha/Library/Python/3.8/include/python3.8/n2
         cwd: /private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/
    Complete output (15 lines):
    running install
    running build
    running build_ext
    skipping './bindings/python/n2.cpp' Cython extension (up-to-date)
    building 'n2' extension
    creating build
    creating build/temp.macosx-10.14.6-x86_64-3.8
    creating build/temp.macosx-10.14.6-x86_64-3.8/src
    creating build/temp.macosx-10.14.6-x86_64-3.8/bindings
    creating build/temp.macosx-10.14.6-x86_64-3.8/bindings/python
    /usr/local/opt/gcc/bin/gcc-10 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -I./include/ -I./third_party/spdlog/include/ -I./third_party/eigen -Ithird_party/boost/assert/include/ -Ithird_party/boost/bind/include/ -Ithird_party/boost/concept_check/include/ -Ithird_party/boost/config/include/ -Ithird_party/boost/core/include/ -Ithird_party/boost/detail/include/ -Ithird_party/boost/heap/include/ -Ithird_party/boost/iterator/include/ -Ithird_party/boost/mp11/include/ -Ithird_party/boost/mpl/include/ -Ithird_party/boost/parameter/include/ -Ithird_party/boost/preprocessor/include/ -Ithird_party/boost/static_assert/include/ -Ithird_party/boost/throw_exception/include/ -Ithird_party/boost/type_traits/include/ -Ithird_party/boost/utility/include/ -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c ./src/heuristic.cc -o build/temp.macosx-10.14.6-x86_64-3.8/./src/heuristic.o -std=c++14 -O3 -fPIC -march=native -DNDEBUG -DBOOST_DISABLE_ASSERTS -fopenmp
    gcc-10: error: this compiler does not support arm64
    gcc-10: error: unrecognized command-line option '-iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders'
    gcc-10: error: unrecognized command-line option '-iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers'
    error: command '/usr/local/opt/gcc/bin/gcc-10' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/setup.py'"'"'; __file__='"'"'/private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-record-7pd04cpp/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/jobha/Library/Python/3.8/include/python3.8/n2 Check the logs for full command output.

`Library not loaded: /usr/local/opt/gcc/lib/gcc/10/libgomp.1.dylib`

Having some trouble installing n2.

System: macOS
Python: 3.9

❯ brew install 

❯ echo $CC
/usr/local/opt/gcc/bin/gcc-11

❯ echo $CXX
/usr/local/opt/gcc/bin/g++-11

❯ python -m pip instal n2

❯ python -c 'import n2'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: dlopen(/Users/pawlu/Documents/personal/img2bug/.venv/lib/python3.9/site-packages/n2.cpython-39-darwin.so, 2): Library not loaded: /usr/local/opt/gcc/lib/gcc/10/libgomp.1.dylib
  Referenced from: /Users/pawlu/Documents/personal/img2bug/.venv/lib/python3.9/site-packages/n2.cpython-39-darwin.so
  Reason: image not found

N2 in Big-ANN-Benchmarks NeurIPS'21 Challenge?

Dear N2 team

I am reaching out to you on behalf of the organizers of the NeurIPS’21 competition on Billion-Scale Approximate Nearest Neighbor Search Challenge to request your participation.

The competition will use several representative billion-scale datasets -- many newly released for this competition -- with their associated accuracy metrics. There are three tracks depending on hardware settings:
(T1) limited memory
(T2) limited main memory + SSD
(T3) any hardware configuration including accelerators and custom silicon.

With this competition, we hope to develop an understanding of the ideas that apply at a billion-point scale, bridge communities that work on ANNS problems, and provide a platform for newer researchers to contribute and develop this relatively new research area.

For more details about the competition, procedures and organizers, please see: big-ann-benchmarks.com and also watch for updates on https://medium.com/big-ann-benchmarks.

How dose n2 handle zero vectors?

Hi,
I may have some zero vectors in my data, and I'm using the "angular" distance metric. According to the formula (1 - {sum(p i · q i) / sqrt(sum(p i · p i) · sum(q i · q i))}), the denominator will become zero when any of (p, q) is a zero vector.
I have done some experiments and found n2 doesn't report any warning or error when using zero vectors with "angular". Could you let me know how does n2 treat the zero vectors? Like, what's the definition of angular distance in such situation, and where would a zero vector rank when querying the nearest neighbors?
Thank you!

Loading model with mmap lowering searching speed?

Hi.

I'm using n2(Python Interface) for searching NNs, and I tried different ways to load the saved index (1000000 * 768, about 3G).

  1. loading index withuse_mmap=True, which is default. In this way, index.load() takes nearly no time, which seems abnormal. Also, when I call index.search_by_vector, the program stuck for a long time(about 1.5 minutes) before giving the result, and during the time it keeps a low CPU and memory usage.
  2. loading index withuse_mmap=False. In this way, index.load() takes several seconds. When I call index.search_by_vector, the program return the result quickly.

I'm not familiar with mmap and I guess that in the first situation, the model haven't been loaded until I start searching. Could you explained it for me? And which way of loading should I use?

Build fails when no GOPATH is defined

The Makefile implies that when the all target is built the user has Go (and hence, GOPATH) available - when it is not set, it will try to write to /src/n2 in the filesystem and trigger a permission error.

Considering that the core library is native, I don't think Go should be a hard requirement.

Python bindings to static library

Is it possible to create python bindings to a statically-compiled version of the library? The end goal is to compile this on a valid machine and then use the library on a machine which does not have c++11. Alternatively, I could bring in a version of c++11, I'm just pretty unfamiliar with python <-> c++ bindings.

multiple indices

First of all, thanks for sharing your great work as open source.

When I tried to use n2, I found the current n2 v0.1.7 only assumes there is only one index.
For example:
`
num_indices =14

indices =[]
for idx in range(num_indices):
indices.append( HnswIndex(f, "L2"))

num_examples = 1000
for i in range(num_examples):
for idx in range(num_indices):
v = [random.gauss(0, 1) for z in range(f)]
res = indices[idx].add_data(v)

for idx in range(num_indices):
indices[idx].build()

k = 30
for i in range(num_examples):
for idx in range(num_indices):
neighbor_ids = indices[idx].search_by_id(i, k, include_distances =True)
`

Since each index is added with 1000 examples each, the returned ids are supposed to be smaller than 1000 or limited to multiples of 14, but neither was the case.
I am wondering if the support for multiple independent indices is in the future plan.

BR.

Support Hamming-Distance

Nmslib supports using binary data with HNSW, specifically using Jaccard- or Hamming-distance.

I work with ORB-descriptors and would love to be able to use N2 in my work.

Without looking into the code: What so you think about adding support for Hamming-distance into the library?

Can we add support for PPC big endian?

xmmintrin.h cannot be used (in fact, it should be explicitly protected by defines, since otherwise it pulls in ppc64le insns if gcc12 is used). Is it possible to add some basic support for PowerPC?

Windows installation issue

Hi,

I have a Windows 10 machine with Python 3.6.5 installed. In addition to numpy 1.15.2, I have Cython 0.28.5

When I ran the command "pip install n 2", the compilation fails because there is a missing file 'unistd.h'.

I attached the error log for your reference.

Thanks for your help,

Ivan

N2_error_log.zip

missing xmmintrin.h on ARM devices.

I'm trying to install n2 on Jetson AGX Xavier which is ARM based with pip install n2. But it seems xmmintrin.h is not avialable on arm. Are there any solutions for this? Is sse2neon one of the solution?
Here's the error message.

Failed to build n2
Installing collected packages: n2
  Running setup.py install for n2 ... error
    Complete output from command /opt/venv/reticulate/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0hzakljx/n2/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-yghai153-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/venv/reticulate/include/site/python3.6/n2:
    running install
    running build
    running build_ext
    skipping './bindings/python/n2.cpp' Cython extension (up-to-date)
    building 'n2' extension
    creating build
    creating build/temp.linux-aarch64-3.6
    creating build/temp.linux-aarch64-3.6/src
    creating build/temp.linux-aarch64-3.6/bindings
    creating build/temp.linux-aarch64-3.6/bindings/python
    aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./include/ -I./third_party/spdlog/include/ -I./third_party/eigen -Ithird_party/boost/assert/include/ -Ithird_party/boost/bind/include/ -Ithird_party/boost/concept_check/include/ -Ithird_party/boost/config/include/ -Ithird_party/boost/core/include/ -Ithird_party/boost/detail/include/ -Ithird_party/boost/heap/include/ -Ithird_party/boost/iterator/include/ -Ithird_party/boost/mp11/include/ -Ithird_party/boost/mpl/include/ -Ithird_party/boost/parameter/include/ -Ithird_party/boost/preprocessor/include/ -Ithird_party/boost/static_assert/include/ -Ithird_party/boost/throw_exception/include/ -Ithird_party/boost/type_traits/include/ -Ithird_party/boost/utility/include/ -I/opt/venv/reticulate/include -I/usr/include/python3.6m -c ./src/heuristic.cc -o build/temp.linux-aarch64-3.6/./src/heuristic.o -std=c++14 -O3 -fPIC -march=native -DNDEBUG -DBOOST_DISABLE_ASSERTS -fopenmp
    ./src/heuristic.cc:17:10: fatal error: xmmintrin.h: No such file or directory
     #include <xmmintrin.h>
              ^~~~~~~~~~~~~
    compilation terminated.
    error: command 'aarch64-linux-gnu-gcc' failed with exit status 1

[Windows] Support windows

Current, N2 highly depends on GCC and openmp.
This is why we are not yet able to support Windows.

We need to find a way to support Windows.

The core idea behind this library

Hi guys,
this work is based on hnsw but shows promising performance against the original hnsw algorithm, what is the core idea or core change to the original algorithm? Could you provide more documents to illustrate your idea?

[MacOS] Support clang

Current, N2 highly depends on GCC and openmp.
This is why we need to install GCC in MacOS environment to use N2.

We need to find a way to support clang

[Go binding] Linux make error: make: *** [go] Error 1

Commands were executed successfully:
$ git clone https://github.com/kakao/n2.git
$ cd n2
$ git submodule update --init

then

admin@MS7B84:~/Downloads/temp/n2$ make go
github.com/google/go-github (download)
cannot find package "github.com/google/go-github/v33/github" in any of:
/usr/local/go/src/github.com/google/go-github/v33/github (from $GOROOT)
/home/george/go/src/github.com/google/go-github/v33/github (from $GOPATH)
get "golang.org/x/tools/go/packages": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at //golang.org/x/tools/go/packages?go-get=1
get "golang.org/x/tools/go/packages": verifying non-authoritative meta tag
golang.org/x/tools (download)
get "golang.org/x/mod/semver": found meta tag get.metaImport{Prefix:"golang.org/x/mod", VCS:"git", RepoRoot:"https://go.googlesource.com/mod"} at //golang.org/x/mod/semver?go-get=1
get "golang.org/x/mod/semver": verifying non-authoritative meta tag
golang.org/x/mod (download)
get "golang.org/x/xerrors": found meta tag get.metaImport{Prefix:"golang.org/x/xerrors", VCS:"git", RepoRoot:"https://go.googlesource.com/xerrors"} at //golang.org/x/xerrors?go-get=1
golang.org/x/xerrors (download)
github.com/google/pprof (download)
github.com/golang/mock (download)
get "golang.org/x/time/rate": found meta tag get.metaImport{Prefix:"golang.org/x/time", VCS:"git", RepoRoot:"https://go.googlesource.com/time"} at //golang.org/x/time/rate?go-get=1
get "golang.org/x/time/rate": verifying non-authoritative meta tag
golang.org/x/time (download)
github.com/google/uuid (download)
github.com/google/go-querystring (download)
get "google.golang.org/appengine": found meta tag get.metaImport{Prefix:"google.golang.org/appengine", VCS:"git", RepoRoot:"https://github.com/golang/appengine"} at //google.golang.org/appengine?go-get=1
google.golang.org/appengine (download)
get "google.golang.org/appengine/log": found meta tag get.metaImport{Prefix:"google.golang.org/appengine", VCS:"git", RepoRoot:"https://github.com/golang/appengine"} at //google.golang.org/appengine/log?go-get=1
get "google.golang.org/appengine/log": verifying non-authoritative meta tag
get "golang.org/x/term": found meta tag get.metaImport{Prefix:"golang.org/x/term", VCS:"git", RepoRoot:"https://go.googlesource.com/term"} at //golang.org/x/term?go-get=1
golang.org/x/term (download)
github.com/GoKillers/libsodium-go (download)
github.com/PuerkitoBio/goquery (download)
github.com/andybalholm/cascadia (download)
cannot find package "github.com/google/go-github/v32/github" in any of:
/usr/local/go/src/github.com/google/go-github/v32/github (from $GOROOT)
/home/george/go/src/github.com/google/go-github/v32/github (from $GOPATH)
github.com/xlzd/gotp (download)
github.com/pmezard/go-difflib (download)
github.com/cheggaaa/pb (download)
github.com/mattn/go-runewidth (download)
github.com/rivo/uniseg (download)
github.com/davecgh/go-spew (download)
github.com/stretchr/objx (download)
github.com/stretchr/testify (download)
get "gopkg.in/yaml.v3": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v3", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v3"} at //gopkg.in/yaml.v3?go-get=1
gopkg.in/yaml.v3 (download)
github.com/graph-gophers/graphql-go (download)
github.com/opentracing/opentracing-go (download)
github.com/pkg/errors (download)
get "go4.org/syncutil/singleflight": found meta tag get.metaImport{Prefix:"go4.org", VCS:"git", RepoRoot:"https://github.com/go4org/go4"} at //go4.org/syncutil/singleflight?go-get=1
get "go4.org/syncutil/singleflight": verifying non-authoritative meta tag
go4.org (download)
get "golang.org/x/build/autocertcache": found meta tag get.metaImport{Prefix:"golang.org/x/build", VCS:"git", RepoRoot:"https://go.googlesource.com/build"} at //golang.org/x/build/autocertcache?go-get=1
get "golang.org/x/build/autocertcache": verifying non-authoritative meta tag
golang.org/x/build (download)
github.com/envoyproxy/go-control-plane (download)
github.com/cncf/xds (download)
github.com/envoyproxy/protoc-gen-validate (download)
github.com/cncf/udpa (download)
github.com/census-instrumentation/opencensus-proto (download)
github.com/golang/glog (download)
github.com/google/cel-go (download)
github.com/stoewer/go-strcase (download)
github.com/antlr/antlr4 (download)
get "gopkg.in/check.v1": found meta tag get.metaImport{Prefix:"gopkg.in/check.v1", VCS:"git", RepoRoot:"https://gopkg.in/check.v1"} at //gopkg.in/check.v1?go-get=1
gopkg.in/check.v1 (download)
github.com/kr/pretty (download)
github.com/kr/text (download)
github.com/rogpeppe/go-internal (download)
get "gopkg.in/src-d/go-git-fixtures.v3": found meta tag get.metaImport{Prefix:"gopkg.in/src-d/go-git-fixtures.v3", VCS:"git", RepoRoot:"https://gopkg.in/src-d/go-git-fixtures.v3"} at //gopkg.in/src-d/go-git-fixtures.v3?go-get=1
gopkg.in/src-d/go-git-fixtures.v3 (download)
github.com/alcortesm/tgz (download)
github.com/jessevdk/go-flags (download)
github.com/armon/go-socks5 (download)
github.com/gliderlabs/ssh (download)
github.com/anmitsu/go-shlex (download)
Makefile:16: recipe for target 'go' failed
make: *** [go] Error 1

Cannot use with pytorch due to libgomp issue

I've found the following issue when trying to use n2 with pytorch in the same project.
It only happens when pytorch is imported BEFORE n2. When n2 is imported, I get this:

>>> import n2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /home/user/workspace/n2/venv/lib/python3.8/site-packages/torch/lib/libgomp-7c85b1e2.so.1: version `GOMP_5.0' not found (required by /home/user/workspace/n2/venv/lib/python3.8/site-packages/n2.cpython-38-x86_64-linux-gnu.so)

Steps to reproduce are very simple.
Just run pip install torch n2 ,then run:

import torch
import n2

My machine is:

  • Python 3.8.6
  • Ubuntu 20.04.2 LTS

Any available workarounds other than forcing import order?

Build fails against icpc (Intel compiler)

This is actually from either Intel of spdlog.

Tested against Parallel Studio 2017.4.049 and 2018.1.031. Build fails due to how icc prefixes symbols on TLS variables in a funny way - I didn't bother to look into the exact details, but a quick and dirty fix has been sent to the original project.

gabime/spdlog#575 has a quick and dirty fix to make this at least build, but you will either need to run on a fork or nag @gabime to look at the PR.

Incomplete benchmarks

Hi guys,

I am trying to reproduce your results. I downloaded your data sets and the benchmark script:
https://github.com/kakao/n2/blob/dev/benchmarks/benchmark_script.py

However, it doesn't have code to test NMSLIB.

Furthermore, on the first page you show query times for HNSW and your method. How did you get these (what is the test script)? There is another picture in your repo, which doesn't indicate there's any difference between N2 and NMSLIB: https://github.com/kakao/n2/blob/dev/docs/imgs/search_time/total.png

How does it correspond to the README picture which shows a 2x difference between two libraries?

Thanks!

Remove duplicated codes.

After #14 is merged,
There are lots of duplicated code on benchmark codes because of my laziness. :)
We need to remove it.

What are the right parameter ?

Hey!

I read your paper and saw that the recommended settings for SIFT are m=16 MaxM0=32, but in my case, the smallest m=2 MaxM0=4 gives me the fastest and bests results. Is there something I m missing here?

Windows installation

When I installed it from source, I get Installation on Windows is not supported yet.

However, when I tried with conda, I still cannot successfully install it.

extended candidates and keep pruned

Hello Team,

I do not see the keep_pruned() and extend_candidate() option in N2 library, where it is impenmented in nsmlib?

Thanks,

Jianshu

multithreaded calls to SearchById() and SearchByVector()

Great package!
I was wondering if the SearchById() and SearchByVector() methods are supposed to be thread-safe? Getting different answers when I use "omp parallel for" clause looping over the set of Ids I am looking up.
Thanks!

Custom Metric

Hello,

I wanted to perform NN search on a dataset of genomes. For this task, the distance between 2 datapoints is calculated by a custom script? Is there I can incorporate this without having to create the entire NN search algorithm myself and only modify some parts of your code?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.