NAME

Algorithm::LSH - perl implementation of Locality Sensitive Hashing

SYNOPSIS

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);

DESCRIPTION

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

THIS MODULE IS IN ITS VERY ALPHA QUALITY.

METHODS

new

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

insert a vector data to buckets.

neighbours

it extracts some datas as neighbours with query vector.

nearest

pickup 1 nearest data from neighbours.

nearest_neighbours

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

nn

an alias of nearest_neighbours()

distance

save

save the data to storage.

load

load th data from storage

hash

accessor method

bucket

accessor method

storage

accessor method

AUTHOR

Takeshi Miki <miki@cpan.org>

LICENSE

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

SEE ALSO