Hora
[Homepage] [Document] [Examples]
Hora Search Everywhere!
Hora is an approximate nearest neighbor search algorithm (wiki) library. We implement all code in Rust๐ฆ
for reliability, high level abstraction and high speeds comparable to C++
.
Hora, ใใปใใ
in Japanese, sounds like [hลlษ]
, and means Wow
, You see!
or Look at that!
. The name is inspired by a famous Japanese song ใๅฐใใชๆใฎใใใ
.
Demos
๐ฉ Face-Match [online demo], have a try!
๐ท Dream wine comments search [online demo], have a try!
Features
-
Performant โก๏ธ
- SIMD-Accelerated (packed_simd)
- Stable algorithm implementation
- Multiple threads design
-
Supports Multiple Languages โ๏ธ
Python
Javascript
Java
Go
(WIP)Ruby
(WIP)Swift
(WIP)R
(WIP)Julia
(WIP)- Can also be used as a service
-
Supports Multiple Indexes ๐
-
Portable ๐ผ
- Supports
WebAssembly
- Supports
Windows
,Linux
andOS X
- Supports
IOS
andAndroid
(WIP) - Supports
no_std
(WIP, partial) - No heavy dependencies, such as
BLAS
- Supports
-
Reliability ๐
Rust
compiler secures all code- Memory managed by
Rust
for all language libraries such asPython's
- Broad testing coverage
-
Supports Multiple Distances ๐งฎ
Dot Product Distance
Euclidean Distance
Manhattan Distance
Cosine Similarity
-
Productive โญ
- Well documented
- Elegant, simple and easy to learn API
Installation
Rust
in Cargo.toml
[]
= "0.1.1"
Python
Javascript (WebAssembly)
Building from source
Benchmarks
by aws t2.medium (CPU: Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz)
more information
Examples
Rust
example [more info]
use ANNIndex;
use ;
use ;
Python
example [more info]
= 50
= 1000
# init index instance
=
=
# add node
# build index
=
# 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]
# search
JavaScript
example [more info]
import * as horajs from "horajs";
const
;
Java
example [more info]
public void
private static float
Roadmap
- Full test coverage
- Implement EFANNA algorithm to achieve faster KNN graph building
- Swift support and iOS/macOS deployment example
- Support
R
- support
mmap
Related Projects and Comparison
-
Hora
's implementation is strongly inspired by these libraries.Faiss
focuses more on the GPU scenerio, andHora
is lighter than Faiss (no heavy dependencies).Hora
expects to support more languages, and everything related to performance will be implemented by Rust๐ฆ.Annoy
only supports theLSH (Random Projection)
algorithm.ScaNN
andFaiss
are less user-friendly, (e.g. lack of documentation).- Hora is ALL IN RUST ๐ฆ.
-
Milvus
andVald
also support multiple languages, but serve as a service instead of a libraryMilvus
is built upon some libraries such asFaiss
, whileHora
is a library with all the algorithms implemented itself
Contribute
We appreciate your help!
We are glad to have you participate, any contributions are welcome, including documentations and tests.
You can create a Pull Request
or Issue
on GitHub, and we will review it as soon as possible.
We use GitHub issues for tracking suggestions and bugs.
Clone the repo
Build
Test
Try the changes
License
The entire repository is licensed under the Apache License.