Created
May 24, 2010 06:12
-
-
Save hamilton/411577 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lsh | |
lsh_machine = lsh.LSH(assignment_name="example") | |
# data is a dictionary of the form: | |
#{user_id: set([item_id1, item_id2, ...]), ...} | |
# Depending on the input size, training can take a while. | |
# But it will use all your cores to do so, and will | |
# automatically cache the data for assignment_name. This | |
# means you only need to process data once, | |
# and you can add more as it comes. | |
lsh_machine.bin_data(data, dims=largest_item_id_number) | |
# now supply a key and data point: | |
lsh.near_neighbors(some_user_id, data[some_user_id]) | |
# just like that. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment