hora wasm
1.0.0
[Page d'accueil] [Document] [Exemples] [Hora]
Enchères Javascript pour la Hora Approximate Nearest Neighbor Search
, à la manière de WebAssembly .
Performant ⚡️
Prise en charge de plusieurs index
Hierarchical Navigable Small World Graph Index(HNSWIndex)
(détail)Satellite System Graph (SSGIndex)
(détail)Product Quantization Inverted File(PQIVFIndex)
(détail)Random Projection Tree(RPTIndex)
(LSH, WIP)BruteForce (BruteForceIndex)
(implémentation naïve avec SIMD)Fiabilité
Rust
sécurise tout le codeRust
pour toutes les bibliothèques de langage telles que Python lib
Prise en charge de plusieurs distances ?
Dot Product Distance
Euclidean Distance
Manhattan Distance
Cosine Similarity
Productif
par aws t2.medium (CPU: Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz)
plus d'informations
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 ( ) ;
} ) ( ) ;
L'intégralité du dépôt est sous licence Apache.