Takeshi Miki >
Algorithm-LSH-0.00001_01 >
Algorithm::LSH

Module Version: 0.00001_01
Algorithm::LSH - perl implementation of Locality Sensitive Hashing

use Algorithm::LSH; my $lsh = Algorithm::LSH->new( L => 5, # number of hash functions k => 10, # number of reductions d => 3, # number of dimentions, ); while(my($label, $vector) = each %database){ $lsh->insert($label, $vector); } $lsh->save("data.bin"); my $query_vector = [ 123, 456, 789 ]; $lsh->load("data.bin"); my $neighbours = $lsh->neighbours($query_vector); my $nearest = $lsh->nearest($neighbours); # or my $nearest = $lsh->nearest_neighbours($query_vector); # or my $nearest = $lsh->nn($query_vector);

Algorithm::LSH is a perl implementation of Locality Sensitive Hashing algorithm.

**THIS MODULE IS IN ITS VERY ALPHA QUALITY.**

constructor. it needs three parameters.

L : a number of hash function. k : a number of reduction. it must be smaller than parameter 'd'. d : a number of dimention.

insert a vector data to buckets.

it extracts some datas as neighbours with query vector.

pickup 1 nearest data from neighbours.

it does neighbours() and nearset() at onece.

an alias of nearest_neighbours()

save the data to storage.

load th data from storage

accessor method

accessor method

accessor method

Takeshi Miki <miki@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: