12 Jun 2007 14:04:42 UTC
- Distribution: Statistics-Suggest
- Module version: 0.01
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (0 / 356 / 0)
- KwaliteeBus factor: 0
- 54.20% Coverage
- License: unknown
- Activity24 month
- Download (35.55KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- SEE ALSO
- COPYRIGHT AND LICENSE
Statistics::Suggest - Perl binding for collaborative filtering library SUGGEST.
Download SUGGEST from http://glaros.dtc.umn.edu/gkhome/suggest/download.
libsuggest.awhich matches your environment and place it under your library path (or specify its path with LIBS option as shown below).
perl Makefile.PL [LIBS='-L/where/to/find/libsuggest.a -lsuggest'] make make test make install
Tested with suggest-1.0-linux.
use Statistics::Suggest; ## initialize SUGGEST with $data my $data = [ # array of [$user_id, $item_id], ... [1, 1], [1, 2], [1, 4], [1, 5] [2, 1], [2, 2], [2, 4], [3, 3], [3, 4], [4, 3], [4, 4], [4, 5], ... ]; my $s = new Statistics::Suggest( RType => 2, NNbr => 40, Alpha => 0.3, ); $s->load_trans($data); $s->init; ## make top 10 recommendations for $selected_item_ids my $rcmds; my $selected_item_ids = [1, 2]; $s->top_n($selected_item_ids, 10, \$rcmds) print "recommendations: " . join(',', @$rcmds);
This is a perl binding for SUGGEST. Please refer to the SUGGEST's manual for details. Basically, this package contains all corresponding methods for functions described in the manual.
my $s = new Statistics::Suggest( # parameters for Init function (see SUGGEST's manual p.5) RType => 2, NNbr => 40, Alpha => 0.3, );
Loads user-item transactions that will be used to make recommendations.
$s->load_trans([ # [user_id, item_id], ... [1, 1], [1, 2], [1, 4],... ]);
Alphaparameter can be set automatically by calling
load_trans, before calling
Initializes the SUGGEST engine. Should be called after all transactions are loaded via
Returns top-n recommendations for the given item set. Should be called after
my $rcmds; $s->top_n( [3, 4, 5, ... ], # array of item_ids in the user's basket 10, # number of recommendations required \$rcmds, # reference of an array reference for storing recommendations ); print join(',', @$rcmds);
None by default.
Ikuhiro IHARA <email@example.com>
Copyright (C) 2007 by Ikuhiro IHARA
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.
Module Install Instructions
To install Statistics::Suggest, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Statistics::Suggest
For more information on module installation, please visit the detailed CPAN module installation guide.