experience of the alternatives. In everyday life, we rely on recommendations from other people either by word of mouth, recommendation letters, movie and book reviews printed in newspapers, or general surveys such as Zagat’s restaurant guides. Recommender systems assist and augment this natural social process. ਪનγεςϜͱ [Resnick+ 97] ࣗͷܦݧ͔ΒͷΈͰ͋·ΓΑ͘Θ͔Βͳ͍ͷͷத͔ΒɼͲ͏ ͯ͠ͲΕ͔Λબͳ͚ΕͳΒͳ͍ͱ͍͏͜ͱΑ͋͘Δɻ͜ͷ Α͏ͳࡍΘͨͨͪ͠ɼޱίϛɼਪનঢ়ɼ ৽ฉͷॻධөըධɼϨ ετϥϯΨΠυͳͲͷଞਓ͔ΒͷਪનʹཔΔ͜ͱΛ ৗతʹߦͬͯ ͍Δɻ ਪનγεςϜͱɼ͜͏ͨࣾ͠ձͰී௨ʹߦΘΕ͍ͯΔҰ࿈ ͷߦҝΛิॿͨ͠Γɼଅਐͨ͠Γ͢ΔͷͰ͋Δɻ [Resnick 97] P. Resnick and H. R. Varian. Recommender systems. Communications of the ACM, Vol. 40, No. 3, pp. 56–58, 1997.
ਪનγεςϜ: ͲΕ͕Ձͷ͋Δͷ͔ಛఆ͢ΔͷΛॿ͚Δಓ۩ [Konstan 03] J. A. Konstan and J. Riedl. Recommender systems: Collaborating in commerce and communities. In Proc. of the SIGCHI Conf. on Human Factors in Computing Systems, Tutorial, 2003.
ਪનγεςϜ: ͲΕ͕Ձͷ͋Δͷ͔ಛఆ͢ΔͷΛॿ͚Δಓ۩ [Konstan 03] J. A. Konstan and J. Riedl. Recommender systems: Collaborating in commerce and communities. In Proc. of the SIGCHI Conf. on Human Factors in Computing Systems, Tutorial, 2003.
len(x.union(y)) return float(intersection / union) ࠓճྨࣅईͷܭࢉʹδϟοΧʔυʢJaccard indexʣΛར༻ →ʮ̎ͭͷू߹ʹؚ·Ε͍ͯΔཁૉͷ͏ͪڞ௨ཁૉ͕ΊΔׂ߹ʯΛද͢ɻ Ϣʔβ͕ߪೖͨ͠ΞΠςϜͷू߹Ͳ͏͠ͷ δϟοΧʔυΛྨࣅʹ → ಉ͡ΞΠςϜΛߪೖ͍ͯ͠ΔϢʔβ΄Ͳྨࣅ a = set(key for key, val in data["A"].items() if val == 1) c = set(key for key, val in data["C"].items() if val == 1) >>> a {'φϧχΞ', 'ࢦྠޠ', 'ϋϦϙλ'} >>> c {'φϧχΞ', 'ࢦྠޠ'} >>> jaccard_similarity(a, c) 0.6666666666666666 1. ϢʔβͲ͏͠ͷྨࣅΛܭࢉͯ͠ɼᅂͷࣅ͍ͯΔϢʔβΛݟ͚ͭΔɻ
= data[user1] history2 = data[user2] # ྆ํͱͷϢʔβʹਪન͞ΕͨΞΠςϜͷू߹ΛͱΔɻ recommended_items1 = set(history1.keys()) recommended_items2 = set(history2.keys()) recommended_both = recommended_items1.intersection(recommended_items2) #྆ํͱʹਪન͞ΕͨΞΠςϜ͕ͳ͚Εྨࣅ 0 ͱ͢Δɻ if len(recommended_both) == 0: return 0.0 # ྆ํͱͷϢʔβʹਪન͞Ε͍͔ͯͯͭɼߪೖͨ͠ΞΠςϜͷू߹ΛͱΔɻ possitive_items1 = set([key for key, val in history1.items() if key in recommended_both and val == 1]) possitive_items2 = set([key for key, val in history2.items() if key in recommended_both and val == 1]) return jaccard_similarity(possitive_items1, possitive_items2) ϢʔβͲ͏͠ͷྨࣅͷܭࢉ 1. ϢʔβͲ͏͠ͷྨࣅΛܭࢉͯ͠ɼᅂͷࣅ͍ͯΔϢʔβΛݟ͚ͭΔɻ
systems. Communications of the ACM, Vol. 40, No. 3, pp. 56–58, 1997. [Konstan 03] J. A. Konstan and J. Riedl. Recommender systems: Collaborating in commerce and communities. In Proc. of the SIGCHI Conf. on Human Factors in Computing Systems, Tutorial, 2003. http://www.kamishima.net/archive/recsysdoc.pdf https://www.slideshare.net/xamat/recsys-2014-tutorial-the-recommender-problem-revisited http://blog.brainpad.co.jp/entry/2017/02/03/153000 https://www.slideshare.net/KentaOku/ss-50762836 https://qiita.com/hik0107/items/96c483afd6fb2f077985