From 374550a0fa715a8426217e3dd496e52b089375ff Mon Sep 17 00:00:00 2001 From: miguelgfierro Date: Thu, 10 Mar 2022 16:15:12 +0100 Subject: [PATCH 1/2] small clarification --- recommenders/utils/python_utils.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/recommenders/utils/python_utils.py b/recommenders/utils/python_utils.py index e79a828d67..b9fa606fce 100644 --- a/recommenders/utils/python_utils.py +++ b/recommenders/utils/python_utils.py @@ -27,6 +27,11 @@ def exponential_decay(value, max_val, half_life): def jaccard(cooccurrence): """Helper method to calculate the Jaccard similarity of a matrix of co-occurrences. + When comparing Jaccard with count co-occurrence and lift similarity, count favours + predictability, meaning that the most popular items will be recommended most of + the time. Lift, by contrast, favours discoverability/serendipity, meaning that an + item that is less popular overall but highly favoured by a small subset of users + is more likely to be recommended. Jaccard is a compromise between the two. Args: cooccurrence (numpy.ndarray): the symmetric matrix of co-occurrences of items. @@ -46,7 +51,10 @@ def jaccard(cooccurrence): def lift(cooccurrence): - """Helper method to calculate the Lift of a matrix of co-occurrences. + """Helper method to calculate the Lift of a matrix of co-occurrences. In comparison + with basic co-occurrence and Jaccard similarity, lift favours discoverability and + serendipity, as opposed to co-occurrence that favours the most popular items, and + Jaccard that is a compromise between the two. Args: cooccurrence (numpy.ndarray): The symmetric matrix of co-occurrences of items. From 8fc4b48dd18f7536bc444e8bb87bc6de0259a148 Mon Sep 17 00:00:00 2001 From: miguelgfierro Date: Thu, 10 Mar 2022 17:13:51 +0100 Subject: [PATCH 2/2] :bug: --- recommenders/utils/python_utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/recommenders/utils/python_utils.py b/recommenders/utils/python_utils.py index b9fa606fce..163ca4fa78 100644 --- a/recommenders/utils/python_utils.py +++ b/recommenders/utils/python_utils.py @@ -27,10 +27,10 @@ def exponential_decay(value, max_val, half_life): def jaccard(cooccurrence): """Helper method to calculate the Jaccard similarity of a matrix of co-occurrences. - When comparing Jaccard with count co-occurrence and lift similarity, count favours - predictability, meaning that the most popular items will be recommended most of - the time. Lift, by contrast, favours discoverability/serendipity, meaning that an - item that is less popular overall but highly favoured by a small subset of users + When comparing Jaccard with count co-occurrence and lift similarity, count favours + predictability, meaning that the most popular items will be recommended most of + the time. Lift, by contrast, favours discoverability/serendipity, meaning that an + item that is less popular overall but highly favoured by a small subset of users is more likely to be recommended. Jaccard is a compromise between the two. Args: @@ -52,9 +52,9 @@ def jaccard(cooccurrence): def lift(cooccurrence): """Helper method to calculate the Lift of a matrix of co-occurrences. In comparison - with basic co-occurrence and Jaccard similarity, lift favours discoverability and + with basic co-occurrence and Jaccard similarity, lift favours discoverability and serendipity, as opposed to co-occurrence that favours the most popular items, and - Jaccard that is a compromise between the two. + Jaccard that is a compromise between the two. Args: cooccurrence (numpy.ndarray): The symmetric matrix of co-occurrences of items.