GithubHelp home page GithubHelp logo

hora-search / horapy Goto Github PK

View Code? Open in Web Editor NEW
69.0 5.0 10.0 98 KB

๐Ÿ Python bidding for the Hora Approximate Nearest Neighbor Search Algorithm library

Home Page: https://horasearch.com

License: Apache License 2.0

Python 54.09% Rust 45.91%
python search approximate-nearest-neighbor-search artificial-intelligence search-engine image-search recommendation-system python-library

horapy's Introduction

horapy

[Homepage] [Document] [Examples] [Hora]

Python binding for the Hora Approximate Nearest Neighbor Search

Key Features

  • Performant โšก๏ธ

    • SIMD-Accelerated (packed_simd)
    • Stable algorithm implementation
    • Multiple threads design
  • Multiple Indexes Support ๐Ÿš€

    • Hierarchical Navigable Small World Graph Index(HNSWIndex) (detail)
    • Satellite System Graph (SSGIndex) (detail)
    • Product Quantization Inverted File(PQIVFIndex) (detail)
    • Random Projection Tree(RPTIndex) (LSH, WIP)
    • BruteForce (BruteForceIndex) (naive implementation with SIMD)
  • Portable ๐Ÿ’ผ

    • Support no_std (WIP, partial)
    • Support Windows, Linux and OS X
    • Support IOS and Android (WIP)
    • No heavy dependency, such as BLAS
  • Reliability ๐Ÿ”’

    • Rust compiler secure all code
    • Memory managed by Rust
    • Broad testing coverage
  • Multiple Distances Support ๐Ÿงฎ

    • Dot Product Distance
      • equation
    • Euclidean Distance
      • equation
    • Manhattan Distance
      • equation
    • Cosine Similarity
      • equation
  • Productive โญ

    • Well documented
    • Elegant and simple API, easy to learn

Benchmark

by aws t2.medium (CPU: Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz) more information

Installation

pip install horapy

Example

import numpy as np
from horapy import HNSWIndex

dimension = 50
n = 1000

# init index instance
index = HNSWIndex(dimension, "usize")

samples = np.float32(np.random.rand(n, dimension))
for i in range(0, len(samples)):
    # add node
    index.add(np.float32(samples[i]), i)

index.build("euclidean")  # build index

target = np.random.randint(0, n)
# 410 in Hora ANNIndex <HNSWIndexUsize> (dimension: 50, dtype: usize, max_item: 1000000, n_neigh: 32, n_neigh0: 64, ef_build: 20, ef_search: 500, has_deletion: False)
# has neighbors: [410, 736, 65, 36, 631, 83, 111, 254, 990, 161]
print("{} in {} \nhas neighbors: {}".format(
    target, index, index.search(samples[target], 10)))  # search

License

The entire repo is under Apache License.

horapy's People

Contributors

amrrs avatar salamer 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

Watchers

 avatar  avatar  avatar  avatar  avatar

horapy's Issues

hnsw.search?

  1. Is the result list returned in order by closest to most distant match?
    Thank you

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.