yahoojapan / NGT

Nearest Neighbor Search with Neighborhood Graph and Tree for High-dimensional Data
Apache License 2.0
1.24k stars 114 forks source link

ngtpy.Index' object has no attribute 'get_num_of_distance_computations' #27

Closed bagavi closed 5 years ago

bagavi commented 5 years ago

I install ngt using pip3 install ngt and on running the sample code - https://github.com/yahoojapan/NGT/blob/master/python/sample/sample.py -- I get the following error

  File "sample.py", line 38, in <module>
    print('# of distance computations=' + str(index.get_num_of_distance_computations()))
AttributeError: 'ngtpy.Index' object has no attribute 'get_num_of_distance_computations'
  1. How is number of distance defined?
  2. Is there any other way to calculate the number of distances?
masajiro commented 5 years ago

When you would like to get the number of distance computations, you have to build and install from the source with the define NGT_DISTANCE_COMPUTATION_COUNT below.

cd (NGT_ROOT)
mkdir build
cd build
cmake -DNGT_DISTANCE_COMPUTATION_COUNT=ON ..
make
make install
ldconfig /usr/local/lib

Then, you have to build and install ngtpy from the source according to ngtpy README.

If you have already installed ngtpy with pip, please uninstall it.