Non Metric Space (Approximate) Library

A Non-Metric Space Library ('NMSLIB' < https://github.com/searchivarius/nmslib>) wrapper, which according to the authors "is an efficient cross-platform similarity search library and a toolkit for evaluation of similarity search methods. The goal of the 'NMSLIB' < https://github.com/searchivarius/nmslib> Library is to create an effective and comprehensive toolkit for searching in generic non-metric spaces. Being comprehensive is important, because no single method is likely to be sufficient in all cases. Also note that exact solutions are hardly efficient in high dimensions and/or non-metric spaces. Hence, the main focus is on approximate methods". The wrapper also includes Approximate Kernel k-Nearest-Neighbor functions based on the 'NMSLIB' < https://github.com/searchivarius/nmslib> 'Python' Library.



The nmslibR package is a wrapper of the Non-Metric Space Library (NMSLIB) python package. More details on the functionality of the nmslibR package can be found in the package Documentation and Vignette.


Reference:

https://github.com/searchivarius/nmslib

https://github.com/searchivarius/nmslib/blob/master/manual/manual.pdf


System Requirements


  • Python (>= 2.7)

All modules should be installed in the default python configuration (the configuration that the R-session displays as default), otherwise errors will occur during the nmslibR package installation (reticulate::py_discover_config() might be useful here).


The installation notes for Linux, Macintosh, Windows are based on Python 3.


Debian/Ubuntu


Installation of the system requirements,


 
sudo apt-get install python3-pip
 
sudo pip3 install --upgrade setuptools
 
sudo pip3 install -U numpy
 
sudo pip3 install --upgrade scipy
 
sudo apt-get install libboost-all-dev libgsl0-dev libeigen3-dev
 
sudo apt-get install cmake
 
pip3 install --upgrade pybind11
 
sudo pip3 install nmslib
 

Fedora


Installation of the system requirements,


 
dnf install python3-pip
 
sudo pip3 install --upgrade setuptools
 
sudo pip3 install -U numpy
 
sudo pip3 install --upgrade scipy
 
yum install python3-devel
 
yum install boost-devel
 
yum install gsl-devel
 
yum install eigen3-devel
 
pip3 install --upgrade pybind11
 
sudo pip3 install nmslib
 

Macintosh OSX


Upgrade python to version 3 using,

 
brew upgrade python
 

Install the requirements,


 
sudo pip3 install --upgrade pip setuptools wheel
 
sudo pip3 install -U numpy
 
sudo pip3 install --upgrade scipy
 
brew install boost
 
brew install eigen
 
brew install gsl
 
brew install cmake
 
brew link --overwrite cmake
 
pip3 install --upgrade pybind11
 
sudo pip3 install nmslib
 

After a successful installation of the requirements the user should open an R session and give the following reticulate command to change to the relevant (brew-python) directory (otherwise the nmslibR package won't work properly),


 
reticulate::use_python('/usr/local/bin/python3')
 
 

and then,


 
reticulate::py_discover_config()
 
 

to validate that a user is in the python version where nmslibR is installed.



Windows OS


First download of get-pip.py for windows


Update the Environment variables ( Control Panel >> System and Security >> System >> Advanced system settings >> Environment variables >> System variables >> Path >> Edit ) by adding ( for instance in case of python 2.7 ),


 
C:\Python36;C:\Python36\Scripts
 
 

Install the Build Tools for Visual Studio


Open the Command prompt (console) and install / upgrade the system requirements,


 
pip3 install --upgrade pip setuptools wheel
 
pip3 install -U numpy
 
pip3 install --upgrade scipy
 

Installation of cmake


First download cmake for Windows, win64-x64 Installer. Once the file is downloaded run the .exe file and during installation make sure to add CMake to the system PATH for all users.


Then install the nmslib library,


 
pip3 install --upgrade pybind11
 
pip3 install nmslib
 

Installation of the nmslibR package


To install the package from CRAN use,


 
install.packages('nmslibR')
 
 

and to download the latest version from Github use the install_github function of the devtools package,

 
devtools::install_github(repo = 'mlampros/nmslibR')
 

Use the following link to report bugs/issues,

https://github.com/mlampros/nmslibR/issues


News

nmslibR 1.0.3

I updated the README.md file and especially the installation instructions for all mentioned operating systems i.e. Linux, Macintosh, Windows (switch from python2 to python3 due to pybind11 issues).

nmslibR 1.0.2

  • The dgCMatrix_2scipy_sparse function was renamed to TO_scipy_sparse and now accepts either a dgCMatrix or a dgRMatrix as input. The appropriate format for the nmslibR package in case of sparse matrices is the dgRMatrix format (scipy.sparse.csr_matrix)
  • I added an onload.R file to inform the users about the previous change [ related with the issue : https://github.com/mlampros/nmslibR/issues/1 ]
  • I removed the utils.R file which included internal functions of the KernelKnn package. Rather than including the file I now use the getFromNamespace function of the utils package.
  • Due to the previous changes I modified the Vignette and the tests too.

nmslibR 1.0.1

  • I commented the example(s) and test(s) related to the dgCMatrix_2scipy_sparse function [ if (Sys.info()["sysname"] != 'Darwin') ], because the scipy-sparse library on CRAN is not upgraded and the older version includes a bug (TypeError : could not interpret data type). This leads to an error on Macintosh Operating System ( reference : https://github.com/scipy/scipy/issues/5353 )
  • I added links to the github repository (master repository, issues)

nmslibR 1.0.0

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("nmslibR")

1.0.3 by Lampros Mouselimis, 10 months ago


https://github.com/mlampros/nmslibR


Report a bug at https://github.com/mlampros/nmslibR/issues


Browse source code at https://github.com/cran/nmslibR


Authors: Lampros Mouselimis [aut, cre] , B. Naidan [cph] (Author of the Non-Metric Space Library (NMSLIB)) , L. Boytsov [cph] (Author of the Non-Metric Space Library (NMSLIB)) , Yu. Malkov [cph] (Author of the Non-Metric Space Library (NMSLIB)) , B. Frederickson [cph] (Author of the Non-Metric Space Library (NMSLIB)) , D. Novak [cph] (Author of the Non-Metric Space Library (NMSLIB))


Documentation:   PDF Manual  


GPL-3 license


Imports Rcpp, reticulate, R6, Matrix, KernelKnn, utils

Suggests testthat, covr, knitr, rmarkdown

Linking to Rcpp, RcppArmadillo

System requirements: Python (>= 2.7), nmslib ( >= 1.7.1), scipy ( >= 1.0.0), numpy ( >= 1.14.0). Detailed installation instructions for each operating system can be found in the README file.


See at CRAN