Last active
August 29, 2015 14:23
-
-
Save JnBrymn-EB/bb3c20b0673b6479f4c0 to your computer and use it in GitHub Desktop.
example recommendation workflow
This file contains hidden or 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
event_clicks = get_clicks() # reusable! | |
# [(user_id, guest_id, event_id),...] | |
event_clicks = collapse_to_person_event(event_clicks) # reusable! testable! | |
# [(person_id, event_id),...] | |
person_to_their_events = event_clicks.reduceByKey(event_clicks) | |
# [(person_id, [event_id,...])...] | |
event_sets = person_to_their_events.values() | |
# [[event_id,...]] | |
event_to_events_cooccurrence = cooccurrence(event_sets) # reusable! testable! | |
# [(event_id, [event_id,...])] | |
person_to_events_recommendations = multiply(person_to_their_events, event_to_events_cooccurrence) # reusable! testable! also, naming is tricky | |
# [(person_id, {event_id:weight...})...] | |
event_to_persons_recommendations = transpose(person_to_events_recommendations) # reusable! testable! | |
# [(event_id, {person_id:weight...}...] | |
recommended_events = event_to_persons_recommendations.keys() | |
# [event_id...] | |
put_recommended_events(recommended_events) # reusable! | |
put_event_to_person_recommendations(event_to_persons_recommendations) # reusable! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment