All Projects → InstantDomain → instant-distance

InstantDomain / instant-distance

Licence: Apache-2.0 license
Fast approximate nearest neighbor searching in Rust, based on HNSW index

Programming Languages

rust
11053 projects
python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to instant-distance

pqlite
⚡ A fast embedded library for approximate nearest neighbor search
Stars: ✭ 141 (+0.71%)
Mutual labels:  approximate-nearest-neighbor-search, hnsw
Milvus
An open-source vector database for embedding similarity search and AI applications.
Stars: ✭ 9,015 (+6339.29%)
Mutual labels:  approximate-nearest-neighbor-search, hnsw
scikit-hubness
A Python package for hubness analysis and high-dimensional data mining
Stars: ✭ 41 (-70.71%)
Mutual labels:  approximate-nearest-neighbor-search
Annoy
Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk
Stars: ✭ 9,262 (+6515.71%)
Mutual labels:  approximate-nearest-neighbor-search
pgvector
Open-source vector similarity search for Postgres
Stars: ✭ 482 (+244.29%)
Mutual labels:  approximate-nearest-neighbor-search
adventures-with-ann
All the code for a series of Medium articles on Approximate Nearest Neighbors
Stars: ✭ 40 (-71.43%)
Mutual labels:  approximate-nearest-neighbor-search
elasticsearch-approximate-nearest-neighbor
Plugin to integrate approximate nearest neighbor(ANN) search with Elasticsearch
Stars: ✭ 53 (-62.14%)
Mutual labels:  approximate-nearest-neighbor-search
NearestNeighborDescent.jl
Efficient approximate k-nearest neighbors graph construction and search in Julia
Stars: ✭ 34 (-75.71%)
Mutual labels:  approximate-nearest-neighbor-search
annoy.rb
annoy-rb provides Ruby bindings for the Annoy (Approximate Nearest Neighbors Oh Yeah).
Stars: ✭ 23 (-83.57%)
Mutual labels:  approximate-nearest-neighbor-search
product-quantization
🙃Implementation of vector quantization algorithms, codes for Norm-Explicit Quantization: Improving Vector Quantization for Maximum Inner Product Search.
Stars: ✭ 40 (-71.43%)
Mutual labels:  approximate-nearest-neighbor-search
lshensemble
LSH index for approximate set containment search
Stars: ✭ 48 (-65.71%)
Mutual labels:  approximate-nearest-neighbor-search
gongt
NGT Go client library
Stars: ✭ 29 (-79.29%)
Mutual labels:  approximate-nearest-neighbor-search
spark-annoy
Building Annoy Index on Apache Spark
Stars: ✭ 73 (-47.86%)
Mutual labels:  approximate-nearest-neighbor-search
Facenet-Caffe
facenet recognition and retrieve by using hnswlib and flask, convert tensorflow model to caffe
Stars: ✭ 30 (-78.57%)
Mutual labels:  hnsw
cuhnsw
CUDA implementation of Hierarchical Navigable Small World Graph algorithm
Stars: ✭ 69 (-50.71%)
Mutual labels:  hnsw

Cover logo

Instant Distance: fast HNSW indexing

Build status License: MIT License: Apache 2.0

Instance Distance is a fast pure-Rust implementation of the Hierarchical Navigable Small Worlds paper by Malkov and Yashunin for finding approximate nearest neighbors. This implementation powers the InstantDomainSearch.com backend services used for word vector indexing.

What it does

Instant Distance is an implementation of a fast approximate nearest neighbor search algorithm. The algorithm is used to find the closest point(s) to a given point in a set. As one example, it can be used to make simple translations.

Using the library

Rust

[dependencies]
instant-distance = "0.5.0"

Example

use instant_distance::{Builder, Search};

fn main() {
    let points = vec![Point(255, 0, 0), Point(255, 0, 0), Point(255, 0, 0)];
    let values = vec!["red", "green", "blue"];

    let map = Builder::default().build(points, values);
    let mut search = Search::default();

    let cambridge_blue = Point(163, 193, 173);

    let closest_point = map.search(&cambridge_blue, &mut search).next().unwrap();

    println!("{:?}", closest_point.value);
}

#[derive(Clone, Copy, Debug)]
struct Point(isize, isize, isize);

impl instant_distance::Point for Point {
    fn distance(&self, other: &Self) -> f32 {
        // Euclidean distance metric
        (((self.0 - other.0).pow(2) + (self.1 - other.1).pow(2) + (self.2 - other.2).pow(2)) as f32)
            .sqrt()
    }
}

Testing

Rust:

cargo t -p instant-distance --all-features

Python:

make test-python
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].