hora wasm
1.0.0
[Homepage] [Dokument] [Beispiele] [Hora]
Javascript-Gebote für die Hora Approximate Nearest Neighbor Search
im WebAssembly- Verfahren.
Performant ⚡️
Unterstützung mehrerer Indizes
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 Implementierung mit SIMD)Zuverlässigkeit
Rust
-Compiler sichert den gesamten CodeRust
verwalteter Speicher für alle Sprachbibliotheken wie Python lib
Unterstützung mehrerer Entfernungen ?
Dot Product Distance
Euclidean Distance
Manhattan Distance
Cosine Similarity
Produktiv
von aws t2.medium (CPU: Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz)
weitere Informationen
npm i horajs
import * as horajs from "horajs" ;
const demo = ( ) => {
const dimension = 50 ;
var bf_idx = horajs . BruteForceIndexUsize . new ( dimension ) ;
// var hnsw_idx = horajs.HNSWIndexUsize.new(dimension, 1000000, 32, 64, 20, 500, 16, false);
for ( var i = 0 ; i < 1000 ; i ++ ) {
var feature = [ ] ;
for ( var j = 0 ; j < dimension ; j ++ ) {
feature . push ( Math . random ( ) ) ;
}
bf_idx . add ( feature , i ) ; // add point
}
bf_idx . build ( "euclidean" ) ; // build index
var feature = [ ] ;
for ( var j = 0 ; j < dimension ; j ++ ) {
feature . push ( Math . random ( ) ) ;
}
console . log ( "bf result" , bf_idx . search ( feature , 10 ) ) ; //bf result Uint32Array(10) [704, 113, 358, 835, 408, 379, 117, 414, 808, 826]
}
( async ( ) => {
await horajs . default ( ) ;
await horajs . init_env ( ) ;
demo ( ) ;
} ) ( ) ;
Das gesamte Repo steht unter der Apache-Lizenz.