Git Product home page Git Product logo

descartes's Introduction

descartes

Introduction

Nearest neighbor search algorithm descartes, based on fng, providing Python API.

Install & Usage

1. Installation

1.1 Configure environment dependencies (recommended in the Docker container created by the Ubuntu image)

sudo apt update && sudo apt install -y git cmake g++ python3 python3-setuptools python3-pip libblas-dev liblapack-dev '''

1.2 Download code

git clone https://github.com/xiaoming-01ai/descartes.git

1.3 Configuration & installation

pip3 install descartes/descartes-*-linux_x86_64.whl

2. Usage

python3 descartes.py

The following describes the algorithm execution logic of descartes.py in steps

2.1 Data load

Method 1: Randomly generate data

n, d = 10000, 128
X = np.random.randn(n, d)

Method 2: Load data from dataset (sift_base.fvecs as an example)

def ivecs_read(fname):
    a = np.fromfile(fname, dtype='int32')
    d = a[0]
    return a.reshape(-1, d + 1)[:, 1:].copy()
def fvecs_read(fname):
    return ivecs_read(fname).view('float32')

X = fvecs_read("sift_base.fvecs")

2.2 Build Index

index = py01ai.FNGIndex(metric="square_l2", dimension=dimension))
index.init(count=1000000, m=32, s=1, l=200)
index.add_vector(input=X)

2.3 Search

v = np.random.randn(1, 128)
results = index.search(query=v, topk=10)
print(results)

3. Performance

glove-25-angular

glove-25-angular

glove-50-angular

glove-50-angular

glove-100-angular

glove-100-angular

glove-200-angular

glove-200-angular

sift-128-euclidean

glove-100-angular fashion-mnist-784-euclidean

fashion-mnist-784-euclidean

nytimes-256-angular

nytimes-256-angular

gist-960-euclidean

gist-960-euclidean

4. Team members

The team members come from 01AI: Xiaoming Peng, Gaofei Wang

descartes's People

Contributors

xiaoming-01ai avatar

Stargazers

Haoyun Xia avatar

Watchers

 avatar

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.