ã¬ã³ã¡ã³ãã¼ã·ã§ã³ã®ç°¡åãªåçãè¦è¦çã«ææ¡ãã¦ããå®éã«è¨ç®ãã¦ã¿ã
Mahoutã·ãªã¼ãºãæåããèªãå ´åã¯ãã¡ãApache Mahoutで機械学習してみるべ - 都元ダイスケ IT-PRESSã
æ¨æ¥åæãããã¼ã¿ã¯ã1çªã®äººã«ãå§ããªã¢ã¤ãã ã¯104ã§ã4.25ç¹ãã¤ããã ãããã¨ããäºæ³ã§ããããªããã®ãããªè¨ç®çµæã«ãªã£ãã®ãããªãã¨ãªãæè¦ãã¤ããã§ã¿ããã
å ¥åã«ä½¿ã£ãCSVãã¼ã¿ããç°¡åã«ã°ã©ãåãã¦ã¿ãã®ãããã ã
ã¬ã³ã¡ã³ã対象ã¨ãªã1çªã®äººã¯ãéã®ã°ã©ãã ããã®éã®ã°ã©ãã®ãã¿ã¼ã³ã«ä¸çªä¼¼ã¦ããã®ã¯ã©ãã ããï¼ 101ã103ãã±ã£ã¨è¦ãæããç´«(5)ã®äººã¨ä¼¼ãå¾æã ã¨æããã¨æããã¾ãã赤(4)ã®äººãåããã¥ãããã©çµæ§ä¼¼ã¦ããã102ã®è©ä¾¡ã¯æãã¦ãããã®ã®ã101*1ã¨103ã®è©ä¾¡ã¯è¿ãã
éã«ãç·(2)ã®äººã¨ã¯æ£å対ã®å¥½ã¿ãæã£ã¦ããããã ãã°ã©ããéè¡ãã¦ãããé»è²(3)ã®äººã¯â¦ãããã¾ãé¢é£æ§ã¯ãªãããã ãªã
ã¨ãããããªãã¨ãèããã¨ã104ã107ã®ã¢ã¤ãã ã«ãä½ç¹ã¤ããããï¼ããè¨ç®ã§ãããç´«ã¨èµ¤ã®äººã®å¾åã¨ä¼¼ã¦ãããã ãããéã®äººã ã£ã¦åãããã«104ã«é«å¾ç¹ãã¤ãããã ãã¾ããç·ã®äººã¨ã¯éã®å¥½ã¿ãæã£ã¦ããã®ã ãããç·ã®äººã104ãé ·è©ãã¦ããã®ã§ããã¯ãéã®äººã«ã¨ã£ã¦ã¯é«å¾ç¹ã«æããã§ããããã¨ããããã ã
ãã¦ãããå°ãæ°å¦çã«ãã¦ã¿ãããããå°ãã ãã
ããäºäººã®ã°ã©ãã®ãã¿ã¼ã³ãã©ã®ç¨åº¦ä¼¼ã¦ããã®ãï¼ ã¨ããã®ãæ°å¤åã§ããããã®æ°å¤åã®å¼ã¯å°ã è¤éãªã®ã§èª¬æããªããã©ããããç¸é¢ä¿æ°ã¨è¨ãã®ã ãããå ¨ãé¢é£æ§ããªãç¶æ ãã0ããå®å ¨ã«ä¸è´ãã1ã¨ãã¾ããããã«ããéã®é¢é£ãæã¤ãã¤ã¾ãç·ã®äººã¯ç¸é¢ä¿æ°ããã¤ãã¹ã¨ãªããæå°å¤ã¯-1ã§ãå®å ¨ã«éç¸é¢ããã®å¤ã-1ã1ã®å®æ°ã¨ãã¦æ±ãã
æ¨æ¥ã®ãã¼ã¿ã®ç¸é¢ä¿æ°ã¯ä»¥ä¸ã®éããç®åéã§èå¯ããçµæã¨ä¸è´ãã¦ããã®ãåããã¨æãã¾ãã
1 vs 1 = 1.0
1 vs 2 = -0.7642652566278799
1 vs 3 = NaN
1 vs 4 = 0.9999999999999998
1 vs 5 = 0.944911182523068
ãã®æ å ±ã表ãã®ã UserSimilarity ã§ãããã¡ãªã¿ã«ãèªåèªèº«ã¨æ¯è¼ãããå®å ¨ä¸è´ã§ããã1.0ã§ããããã¦3ã¯å ±éããè©ä¾¡ã101ãããªãã®ã§ãç¸é¢ä¿æ°ãè¨ç®ã§ããªãã£ãæãã§ãã
次ã«ãããããç¸é¢ä¿æ°ï¼ã®çµ¶å¯¾å¤ï¼é ã«ä¸¦ã¹ããç¹ã«ä¼¼ã¦ãã人ããäºäºº*2é¸ã³åºãã¾ããã¾ãã4ã¨5ã®äººã§ããããã®ãä¼¼ã¦ãã人ãã¡ãã表ãã®ã UserNeighborhood ã§ãã
ã§ã4ã¨5ã®äººãåèã«ãã¦1ã®äººã«å¯¾ãã¦ã¬ã³ã¡ã³ãããã®ã§ãããã§ã¬ã³ã¡ã³ãåè£ã¢ã¤ãã ãçµãè¾¼ãã¾ãã4ã¾ãã¯5ãè©ä¾¡ãã¦ãã¦ããã¤ã1ãè©ä¾¡ãã¦ããªãã¢ã¤ãã ãé¸ã³åºãã¾ãããã®çµæ 104, 105, 106 ã¨ãªãã¾ãã
104ã®ã¢ã¤ãã ã«ã¤ãã¦ã¯ã以ä¸ã®ããã«è©ç¹ã¨ç¸é¢ä¿æ°ãåã³ãã®ç©ãã¾ã¨ãã¾ããã
user | pref | ç¸é¢ä¿æ° | prefÃç¸é¢ | |
4 | 4.5 | 0.99 | 4.50 | |
5 | 4.0 | 0.94 | 3.78 | |
è¨ | - | 1.94 | 8.28 |
ããããã®ããã«å²ã㨠8.28 ÷ 1.94 â 4.26 ã§ãã104ã®äºæ¸¬è©ç¹ã¯ç´4.26ã¨ãªãã¾ããããã®è¨ç®ã¯ãããã加重平均ã§ããéã¿=ç¸é¢ä¿æ°ã§ããã
ä»ã®ã¢ã¤ãã ã«ã¤ãã¦ãåæ§ã®è¨ç®ãããçµæãä¸çªäºæ¸¬è©ç¹ãé«ãã£ã104ããè¦ããããã¨ããããã§ãã
ããããã¬ã³ã¡ã³ãã®ç°¡åãªåçã§ãã