{"id":4931,"date":"2024-10-05T20:01:01","date_gmt":"2024-10-05T12:01:01","guid":{"rendered":""},"modified":"2024-10-05T20:01:01","modified_gmt":"2024-10-05T12:01:01","slug":"\u57fa\u4e8e Java \u673a\u5668\u5b66\u4e60\u81ea\u5b66\u7b14\u8bb0 \uff08\u7b2c54-55\u5929\uff1a\u57fa\u4e8eM-distance\u7684\u63a8\u8350\u7cfb\u7edf\uff09","status":"publish","type":"post","link":"https:\/\/mushiming.com\/4931.html","title":{"rendered":"\u57fa\u4e8e Java \u673a\u5668\u5b66\u4e60\u81ea\u5b66\u7b14\u8bb0 \uff08\u7b2c54-55\u5929\uff1a\u57fa\u4e8eM-distance\u7684\u63a8\u8350\u7cfb\u7edf\uff09"},"content":{"rendered":"

\u6ce8\u610f\uff1a\u672c\u7bc7\u4e3a50\u5929\u540e\u7684Java\u81ea\u5b66\u7b14\u8bb0\u6269\u5145\uff0c\u5185\u5bb9\u4e0d\u518d\u662f\u57fa\u7840\u6570\u636e\u7ed3\u6784\u5185\u5bb9\u800c\u662f\u673a\u5668\u5b66\u4e60\u4e2d\u7684\u5404\u79cd\u7ecf\u5178\u7b97\u6cd5\u3002\u8fd9\u90e8\u5206\u535a\u5ba2\u66f4\u4fa7\u91cd\u4e0e\u7b14\u8bb0\u4ee5\u65b9\u4fbf\u81ea\u5df1\u7684\u7406\u89e3\uff0c\u81ea\u6211\u77e5\u8bc6\u7684\u8f93\u51fa\u660e\u663e\u51cf\u5c11\uff0c\u82e5\u6709\u9519\u8bef\u6b22\u8fce\u6307\u6b63\uff01<\/span><\/p>\n


\n

\u76ee\u5f55<\/strong><\/p>\n

\u51fa\u5904\u8bf4\u660e<\/p>\n

\u4e00\u3001\u7b97\u6cd5\u7b80\u4ecb<\/p>\n

\u00b7 leave-one-out<\/p>\n

\u00b7 \u4e00\u4e9b\u503c\u5f97\u6ce8\u610f\u7684\u4e0ekNN\u7684\u5dee\u5f02<\/p>\n

\u4e8c\u3001\u6570\u636e\u96c6\u51c6\u5907\u4e0e\u4ee3\u7801\u53d8\u91cf\u8bf4\u660e<\/p>\n

\u4e09\u3001\u4ee3\u7801\u8be6\u89e3<\/p>\n

1.\u6784\u9020\u521d\u59cb\u5316<\/p>\n

2.M-distance\u7b97\u6cd5\u7684leave-one-out\u6d4b\u8bd5\u8fc7\u7a0b(\u6838\u5fc3)<\/p>\n

3.\u7b97\u6cd5\u7684\u8bc4\u4ef7\u6307\u6807<\/p>\n

3.1 \u5e73\u5747\u7edd\u5bf9\u8bef\u5dee(Mean Abusolute Error: MAE)<\/p>\n

3.2 \u5747\u65b9\u6839\u8bef\u5dee(Root Mean Square Error: RMSE)<\/p>\n

\u56db\u3001\u8fd0\u884c\u6d4b\u8bd5\u4e0e\u6570\u636e\u5206\u6790<\/p>\n

\u00b7 \u7b2c55\u5929\u5185\u5bb9\uff1a\u8865\u5145\u5b9e\u73b0user-based recommendation.<\/p>\n

1.\u601d\u7ef4\u8f6c\u53d8<\/p>\n

2.\u91cd\u5199\u7684\u6784\u9020\u51fd\u6570<\/p>\n

3.\u91cd\u5199\u7684leave-one-out\u7684\u6d4b\u8bd5\u4ee3\u7801<\/p>\n

4.\u6570\u636e\u6d4b\u8bd5<\/p>\n


\n

\u51fa\u5904\u8bf4\u660e<\/h2>\n

        \u4eca\u65e5\u7684\u7b97\u6cd5\u51fa\u81ea\u4e0b\u9762\u8fd9\u7bc7\u8001\u5e08\u548c\u5e08\u59d0\u5171\u540c\u53d1\u8868\u7684\u8bba\u6587\uff1a Mei Zheng, Fan Min, Heng-Ru Zhang, Wen-Bin Chen, Fast recommendations with the M-distance, IEEE Access 4 (2016) 1464\u20131468. \u70b9\u51fb\u4e0b\u8f7d\u8bba\u6587.<\/p>\n

\u4e00\u3001\u7b97\u6cd5\u7b80\u4ecb<\/h2>\n

        \u7b80\u5355\u6765\u8bf4\u662f\u4e00\u4e2a\u63a8\u8350\u7cfb\u7edf\u3002\u5047\u5982\u5f53\u524d\u7cfb\u7edf\u662f\u4e00\u4e2a\u7535\u5f71\u7684\u8bc4\u5206\u4e0e\u63a8\u8350\u7cfb\u7edf\uff0c\u7cfb\u7edf\u4f1a\u4e3a\u6211\u4eec\u5206\u6790\u8fd9\u4e2a\u7528\u6237\u5bf9\u4e8e\u5176\u4ed6\u7535\u5f71\u7684\u8bc4\u4ef7\u60c5\u51b5\u6765\u51b3\u7b56\u67d0\u4e2a\u7535\u5f71\u5bf9\u4e8e\u6b64\u7528\u6237\u7684\u9002\u5408\u7a0b\u5ea6\uff0c\u5e76\u4ee5\u8bc4\u5206\u8868\u793a\u3002<\/p>\n

\"\u57fa\u4e8e<\/p>\n

         <\/p>\n

        \u56fe\u4f8b\u63cf\u8ff0<\/strong><\/em>\uff1a\u8fd9\u91cc\u662f\u8bba\u6587\u4e2d\u7684\u4e00\u4e2a\u8bc4\u5206\u8868\uff0c\u884c\u8868\u793a\u8fd9\u4e2a\u7528\u6237\u5bf9\u4e8e\u4e00\u7cfb\u5217\u7535\u5f71\u7684\u8bc4\u5206\u60c5\u51b5\uff0c\u4f8b\u5982\\(u_0\\)\u6240\u5728\u884c\u5206\u522b\u662f\\(\\{4,0,3,0,0,3\\}\\)\uff0c\u5206\u522b\u5bf9\u5e94\u4e86\u7528\u6237\\(u_0\\)\u5bf9\u4e8e\u7535\u5f71\\(\\{m_0,m_1,m_2,m_3,m_4,m_5\\}\\)\u7684\u8bc4\u4ef7\uff0c\u7eb5\u5217\u6765\u770b\uff0c\u53ef\u4e0e\u7406\u89e3\u4e3a\u5bf9\u4e8e\u67d0\u90e8\u7535\u5f71\u7684\u4e0d\u540c\u7528\u6237\u8bc4\u4ef7\u3002\u8fd9\u91cc\u76840\u5e76\u4e0d\u662f\u8bc4\u5206\u4e3a0\u800c\u662f\uff0c\u7528\u6237\u5e76\u6ca1\u6709\u770b\u8fd9\u90e8\u7535\u5f71\uff0c\u56e0\u6b64\u7535\u5f71\u5217\u6700\u4e0b\u65b9\u7684\\(num\\)\u8868\u793a\u4e86\u6b64\u7535\u5f71\u7684\u8bc4\u4ef7\u7528\u6237\u6570\u76ee\uff0c\\(sum\\)\u4e3a\u603b\u6570\uff0c\u800c\\(\\bar r\\)\u4e3a\u5e73\u5747\u6570\u3002<\/p>\n

        \u7b97\u6cd5\u9700\u8981\u89e3\u51b3\u7684\u95ee\u9898<\/strong><\/em>\uff1a\u5f53\u6211\u63a9\u76d6\u67d0\u4e2a\u5df2\u7ecf\u8bc4\u5206\u7684\u5185\u5bb9\uff08\u5373\u4e0a\u56fe\u4e2d\u7ea2\u8272\u95ee\u53f7\u8868\u793a\u7684\u6570\u503c\uff09\uff0c\u6211\u662f\u5426\u53ef\u4ee5\u901a\u8fc7\u8fd9\u4e2a\u95ee\u53f7\u5468\u56f4\u7684\u8bc4\u5206\u4fe1\u606f\uff0c\u5bf9\u4e8e\u8fd9\u4e2a\u8bc4\u5206\u8fdb\u884c\u4e00\u4e2a\u9884\u6d4b\uff1f\uff08\u906e\u4f4f\u5c31\u76f8\u5f53\u4e8e\u6d4b\u8bd5\u96c6\u5927\u5c0f\u4e3a1\uff0c\u6d4b\u8bd5\u96c6\u5927\u5c0f\u4e3a\\(N-1\\)\uff09<\/p>\n

        \u7b97\u6cd5\u601d\u8def<\/strong><\/em>\uff1a\u7c7b\u4f3c\u4e8ekNN\uff0c\u6211\u4eec\u8bd5\u7740\u627e\u88ab\u906e\u4f4f\u70b9\u6f5c\u5728\u7684\u90bb\u5c45\uff0c\u4f46\u662f\u9700\u8981\u786e\u5b9a\u57fa\u4e8e\u7535\u5f71\u627e\u90bb\u5c45\u8fd8\u662f\u57fa\u4e8e\u7528\u6237\u627e\u90bb\u5c45\uff0c\u5e76\u4e14\u786e\u5b9a\u90bb\u5c45\u7684\u6307\u6807\u662f\u4ec0\u4e48\u3002<\/p>\n

        M-distance\u7b97\u6cd5\u8ba4\u4e3a\uff0c\u67d0\u4e2a\u70b9\u7684\u90bb\u5c45\u67e5\u627e\u53ef\u4ee5\u57fa\u4e8e\u7535\u5f71\u8bc4\u5206\u60c5\u51b5\uff0c\u5373\u5411\u91cf\\(\\vec m_i\\)\uff1b\u800c\u67e5\u627e\u7684\u6307\u6807\u7684\u8bdd\u5e76\u4e0d\u662f\u8ba1\u7b97\u5411\u91cf\\(\\vec m_i\\)\u4e0e\\(\\vec m_j\\)\u4e4b\u95f4\u7684\u6b27\u6c0f\u8ddd\u79bb\u6216\u8005\u66fc\u54c8\u987f\u8ddd\u79bb\uff0c\u800c\u662f\u76f4\u63a5\u7b97\u7b97\u51fa\u6bcf\u4e2a\u5411\u91cf\u7684\u5e73\u5747\u503c\\(\\bar r\\)\uff08\u8fd9\u91cc\u88ab\u906e\u4f4f\u7684\u90e8\u5206\u4e0d\u7eb3\u5165\u5e73\u5747\u503c\u8ba1\u7b97\uff09\uff0c\u5224\u65ad\u8fc7\u7a0b\u4e2d\u4efb\u610f\u4e00\u4e2a\u7535\u5f71\u7684\u5e73\u5747\u8bc4\u5206\u4e0e\u5f53\u524d\u7535\u5f71\u7684\u5e73\u5747\u8bc4\u5206\u7684\u5dee\u503c\u5982\u679c\u5c0f\u4e8e\u9608\u503c\\(\\delta\\) \u7684\u8bdd\uff0c\u90a3\u4e48\u5c31\u5c06\u5176\u9009\u5b9a\u4e3a\u90bb\u5c45\u3002\u6700\u7ec8\u6c42\u90bb\u5c45\u6570\u7ec4\u7684\u5e73\u5747\u503c\uff0c\u5373\u786e\u5b9a\u4e3a\u6d4b\u8bd5\u96c6\u7684\u9884\u6d4b\u503c\u3002<\/p>\n

\u00b7 leave-one-out<\/h3>\n

        \u5047\u8bbe\u4e00\u6b21\u57fa\u672c\u6d4b\u8bd5\u64cd\u4f5c<\/strong><\/em>\u662f\u4efb\u610f\u4e00\u4e2a\u6570\u636e\u9009\u53d6\u51fa\u6765\u4f5c\u4e3a\u6d4b\u8bd5\u96c6\uff0c\u7136\u540e\u5176\u4f59\u6570\u636e\u4f5c\u4e3a\u8bad\u7ec3\u96c6\uff0c\u4ee5\u6b64\u5bf9\u4e8e\u6d4b\u8bd5\u96c6\u8fdb\u884c\u4e00\u6b21\u9884\u6d4b\u3002\u7136\u540eleave-one-out\u5c31\u662f\u4f9d\u6b21\u904d\u5386\u5168\u90e8\u7684\u6d4b\u8bd5\u96c6\u5e76\u90fd\u8fdb\u884c\u4e00\u6b21\u57fa\u672c\u6d4b\u8bd5\u64cd\u4f5c<\/strong><\/em>\u3002\u56e0\u4e3a\u5f80\u5f80\u6765\u8bf4\uff0c\u7528\u4e8e\u673a\u5668\u5b66\u4e60\u7684\u6570\u636e\u6837\u4f8b\\(N\\)\u90fd\u662f\u6781\u5176\u5e9e\u5927\u7684\uff0c\u800c\u8fd9\u79cd\u64cd\u4f5c\u4f1a\u5bf9\u8fd9\u4e2a\u6837\u4f8b\u8fdb\u884c\\(O(N^2)\\)\u590d\u6742\u5ea6\u7684\u57fa\u7840\u64cd\u4f5c\uff0c\u66f4\u522b\u8bf4\u6bcf\u6b21\u64cd\u4f5c\u7684\u5b66\u4e60\u5f00\u9500\u3002\u6240\u4ee5\u53ea\u6709\u8db3\u591f\u9ad8\u6548\u7684\u7b97\u6cd5\u6211\u4eec\u624d\u4f1a\u8fdb\u884cleave-one-out<\/strong><\/em>\uff08\u6216\u8005\u6570\u636e\u91cf\u6bd4\u8f83\u5c0f\uff1f\uff09<\/p>\n

        \u4f46\u662fleave-one-out\u5f88\u516c\u5e73<\/strong><\/em>\uff01\u56e0\u4e3a\u8fd9\u91cc\u6bcf\u4e2a\u6d4b\u8bd5\u96c6\u7684\u5b66\u4e60\u6700\u5927\u5316\u4e86\uff0c\u80fd\u907f\u514d\u4e00\u4e9b\u5076\u7136\u60c5\u51b5\u3002<\/p>\n

\u00b7 \u4e00\u4e9b\u503c\u5f97\u6ce8\u610f\u7684\u4e0ekNN\u7684\u5dee\u5f02<\/h3>\n

        \u8fd9\u4e2a\u7b97\u6cd5\u662fkNN\u7684\u4e00\u4e2a\u53d8\u79cd\u4f46\u662f\u5374\u4e0ekNN\u6709\u4e9b\u663e\u7136\u7684\u5dee\u5f02<\/p>\n

    \n
  1. \u8fd9\u91cc\u5224\u65ad\u90bb\u5c45\u662f\u57fa\u4e8e\u9608\u503c\\(\\delta\\) \u7684\uff0c\u8fd9\u6837\u7684\u51b3\u65ad\u662f\u5408\u7406\u7684\u3002\u56e0\u4e3a\u5728\u5982\u6b64\u6848\u4f8b\u4e2d\uff0c\u6709\u7684\u7535\u5f71\u770b\u4eba\u591a\u6709\u7684\u5c11\uff0c\u82e5\u5f3a\u884c\u8bbe\u7f6e\u4e00\u4e2a\\(k\\)\u6709\u53ef\u80fd\u5f3a\u8feb\u7eb3\u5165\u4e00\u4e9b\u53c2\u8003\u4ef7\u503c\u4e0d\u5927\u7684\u7535\u5f71\uff0c\u4f1a\u5e72\u6270\u6700\u7ec8\u5e73\u5747\u503c\u7684\u9009\u53d6\u3002\u800c\u9608\u503c\\(\\delta\\)\u53ef\u4ee5\u9650\u5b9a\u53c2\u8003\u4ef7\u503c\u7684\u5c3a\u5ea6\uff0c\u672c\u8eab\u5c31\u662f\u57fa\u4e8e\u53c2\u8003\u4ef7\u503c\u7684\u5c3a\u5ea6\u7684\u5224\u65ad\uff0c\u56e0\u6b64\u66f4\u9002\u7528\u4e8e\u8fd9\u79cd\u60c5\u51b5\u3002<\/li>\n
  2. \u4e0d\u540c\u4e8e\u6628\u65e5\u7684kNN\uff0cM-distance\u6709\u660e\u663e\u7684leave-one-out\u8fc7\u7a0b\u3002\u56e0\u4e3a\u6bcf\u6b21\u5b66\u4e60\u7684\u91cf\u975e\u5e38\u5c0f\uff0c\u53ea\u7528\u5bf9\u6240\u6709\u7535\u5f71\u7684\u8bc4\u5206\u7684\u8fdb\u884c\u6bd4\u5bf9\u5c31\u597d\u4e86\uff0c\u5355\u6b21\u5b66\u4e60\u901f\u5ea6\u975e\u5e38\u5feb\uff0c\u56e0\u6b64\u53ef\u4ee5\u4f7f\u7528leave-one-out\u3002<\/li>\n<\/ol>\n

    \u4e8c\u3001\u6570\u636e\u96c6\u51c6\u5907\u4e0e\u4ee3\u7801\u53d8\u91cf\u8bf4\u660e<\/h2>\n

            \u8bc4\u5206\u8868 (\u7528\u6237, \u9879\u76ee, \u8bc4\u5206) \u7684\u538b\u7f29\u65b9\u5f0f\u7ed9\u51fa. \u89c1 GitHub - FanSmale\/sampledata: Sample data \u4e2d movielens-943u1682m.txt.<\/p>\n

            \u5927\u6982\u5185\u5bb9\u662f<\/p>\n

    \"\u57fa\u4e8e<\/p>\n

             \u8868\u73b0\u4e3a\u5b58\u50a8\u7a00\u758f\u56fe\u7684\u4e09\u5143\u8868\uff1a<\/p>\n\n\n\n\n\n\n\n
    User<\/td>\nMovie<\/td>\nScore<\/td>\n<\/tr>\n
    0<\/td>\n0<\/td>\n5<\/td>\n<\/tr>\n
    0<\/td>\n1<\/td>\n3<\/td>\n<\/tr>\n
    ...<\/td>\n...<\/td>\n...<\/td>\n<\/tr>\n
    942<\/td>\n1329<\/td>\n3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

            \u4e00\u5171\u6709943\u4e2a\u7528\u6237\u4e0e1682\u90e8\u7535\u5f71\uff0c\u6bcf\u884c\u8868\u793a\u4e00\u6b21\u53ef\u9760\u7684\u8bc4\u5206\uff0c\u603b\u5171\u670910 0000\u4e2a\u8bc4\u5206\uff08\u884c\uff09<\/p>\n

    \u53ef\u89c1\u6570\u636e\u6709\u6548\u7387\u53ea\u6709 \\(\\frac{}{943 * 1682} = 0.063\\)\uff0c\u662f\u5178\u578b\u7684\u7a00\u758f\u77e9\u9635\uff0c\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u6211\u4eec\u7684\u6570\u636e\u5b58\u50a8\u8ffd\u6c42\u7684\u662f\u538b\u7f29\u5b58\u50a8\u3002<\/p>\n

     \/** * Default rating for 1-5 points. *\/ public static final double DEFAULT_RATING = 3.0; \/** * The total number of users. *\/ private int numUsers; \/** * The total number of items. *\/ private int numItems; \/** * The total number of ratings (non-zero values) *\/ private int numRatings;<\/code><\/pre>\n

            \u4ee3\u7801\u53d8\u91cf\u90e8\u5206\uff0c\u4f9d\u6b21\u662f\uff1a<\/p>\n

      \n
    1. \u9ed8\u8ba4\u8bc4\u5206\uff0c\u5f53\u65e0\u6cd5\u627e\u5230\u90bb\u5c45\u7684\u65f6\u5019\uff0c\u4f1a\u9ed8\u8ba4\u6309\u7167\u6b64\u8bc4\u5206\uff0c\u907f\u514d0\u5206<\/li>\n
    2. \u7528\u6237\u6570\u76ee\uff0c\u8fd9\u91cc\u5927\u5c0f\u662f943<\/li>\n
    3. \u9879\u76ee\u6570\u76ee\uff0c\u8fd9\u91cc\u5927\u5c0f\u662f1682<\/li>\n
    4. \u6b63\u5e38\u7ed9\u51fa\u7684\u8bc4\u5206\u4e2a\u6570\uff0c\u8fd9\u91cc\u662f<\/li>\n<\/ol>\n
       \/** * The predictions. *\/ private double[] predictions; \/** * Compressed rating matrix. User-item-rating triples. *\/ private int[][] compressedRatingMatrix; \/** * The degree of users (how many item he has rated). *\/ private int[] userDegrees; \/** * The average rating of the current user. *\/ private double[] userAverageRatings;<\/code><\/pre>\n

      \u4ee3\u7801\u53d8\u91cf\u90e8\u5206\uff0c\u4f9d\u6b21\u662f\uff1a<\/p>\n

        \n
      1. predictions\u662f\u5927\u5c0f\u4e3anumRatings\u7684\u6570\u7ec4\uff0c\u4f9d\u6b21\u5bf9\u6bcf\u4e2aleave-one-out\u9009\u53d6\u7684\u6570\u636e\u8fdb\u884c\u8bc4\u5206\uff0c\u56e0\u4e3a\u6b63\u5e38\u8bc4\u5206\u6709numRatings\u4e2a\uff0c\u56e0\u6b64\u4e5f\u8981\u8bc4\u5206\u8fd9\u4e48\u591a\u3002\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\uff0c\u8fd9\u662f\u4e00\u4e2a\u5c06\u4e8c\u7ef4\u538b\u7f29\u6210\u7684\u4e00\u7ef4\u6570\u7ec4<\/li>\n
      2. compressedRatingMatrix\u662f\u7a00\u758f\u56fe\u4e09\u5143\u7ec4\u77e9\u9635\u7684\u76f4\u89c2\u5b58\u50a8\uff0c\u5177\u4f53\u6765\u8bf4\uff0c\u662f\u4e00\u4e2anumRatings*3\u7684\u77e9\u9635<\/li>\n
      3. userDegrees\u662f\u67d0\u4e2a\u7528\u6237\u770b\u5f97\u7535\u5f71\u6570\u76ee\uff0c\u5c31\u6211\u4eec\u6700\u4e0a\u9762\u7ed9\u51fa\u7684\u56fe\u6765\u8bf4\uff0cuserDegrees[2] = 3<\/li>\n
      4. \u67d0\u4e2a\u7528\u6237\u6253\u7684\u6240\u6709\u8bc4\u5206\u7684\u5e73\u5747\u5206\uff0c\u62ff\u4e0a\u56fe\u4e3e\u4f8b\u5c31\u662fuserAverageRatings[2] = \\(\\frac{3+5+4}{3}\\)<\/li>\n<\/ol>\n
         \/** * The degree of users (how many item he has rated). *\/ private int[] itemDegrees; \/** * The average rating of the current item. *\/ private double[] itemAverageRatings; <\/code><\/pre>\n

                 \u8fd9\u4e24\u4e2a\u5c5e\u6027\u7c7b\u4f3c\u4e8euserDegrees\u4e0euserAverageRatings\uff0c\u53ea\u4e0d\u8fc7\u89c6\u89d2\u4e0d\u5728\u884c\uff08\\(\\vec u\\)\uff09\uff0c\u800c\u5728\u5217\uff08\\(\\vec m\\)\uff09\u3002\u4f9d\u636e\u7535\u5f71\u5411\u91cf\u7684M-distance\u4e3b\u8981\u4f9d\u9760\u8fd9\u4e24\u4e2a\uff0c\u4e0a\u9762\u56fe\u4e2d\u6240\u793a\u7684\\(r_i\\)\u5c31\u662fitemAverageRatings\u3002<\/p>\n

         \/** * The first user start from 0. Let the first user has x ratings, the second * user will start from x. *\/ private int[] userStartingIndices; \/** * Number of non-neighbor objects. *\/ private int numNonNeighbors; \/** * The radius (delta) for determining the neighborhood. *\/ private double radius;<\/code><\/pre>\n

                 userStartingIndices\u8868\u793a\u5728\u538b\u7f29\u5b58\u50a8\u5f53\u4e2d\uff0c\u7b2ci\u4e2a\u7528\u6237\u538b\u7f29\u6570\u636e\u7684\u5f00\u59cb\uff1a<\/p>\n

        \"\u57fa\u4e8e<\/p>\n

                \u8fd9\u4e2a\u4e1c\u897f\u53ef\u4ee5\u5feb\u901f\u5728\u538b\u7f29\u6570\u7ec4\u4e2d\u627e\u5230\u6211\u4eec\u5e0c\u671b\u5bfb\u627e\u7684\u7528\u6237\uff0c\u5e76\u4e14\u53d6\u51fa\u8fd9\u4e2a\u7528\u6237\u7cfb\u5217\u7684\u8bc4\u5206\uff08\u904d\u5386\u8fd9\u4e2a\u7528\u6237\u8bc4\u5206\u65f6\uff0c\u4ee5\u8bbf\u95ee\u5230\u4e0b\u4e00\u4e2a\u7528\u6237\u7684\u5f00\u59cb\u4e0b\u6807\u4e3a\u505c\u6b62\uff09 \u3002\u56e0\u4e3a\u4e00\u6b21\u8bc4\u5206\u95f4\u9694\u4e09\u5143\u7ec4\uff0c\u56e0\u6b64\u7528\u6237\u5f00\u59cb\u4e0b\u6807\u603b\u662f3\u7684\u500d\u6570\uff0c\u8fd9\u662f\u4e00\u4e2a\u5173\u952e\u7279\u5f81\uff0c\u56e0\u4e3a\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u7528\u6237\u5f00\u59cb\u4e0b\u6807\u96643\u5f97\u5230\u4e09\u5143\u7ec4\u77e9\u9635\u7684\u884c\u7d22\u5f15<\/strong><\/em>\u3002<\/p>\n

                numNonNeighbors\u8bb0\u5f55\u6ca1\u6709\u90bb\u5c45\u7684\u6570\u636e\u6570\u76ee\uff0c\u9488\u5bf9\u8fd9\u4e9b\u7279\u5b9a\u6570\u636e\u6211\u4eec\u5c06\u9ed8\u8ba4\u8bc4\u5206\u4e3aDEFAULT_RATING\uff1bradius\u5c31\u662f\u6211\u4eec\u7684\u9884\u6d4b\u534a\u5f84\uff0c\u6216\u8005\u8bf4\u9608\u503c\\(\\delta\\)\u3002<\/p>\n

        \u4e09\u3001\u4ee3\u7801\u8be6\u89e3<\/h2>\n

        1.\u6784\u9020\u521d\u59cb\u5316<\/h3>\n
         \/** ************************* * Construct the rating matrix. * * @param paraRatingFilename the rating filename. * @param paraNumUsers number of users * @param paraNumItems number of items * @param paraNumRatings number of ratings ************************* *\/ public MBR(String paraFilename, int paraNumUsers, int paraNumItems, int paraNumRatings) throws Exception { \/\/ Step 1. Initialize these arrays numItems = paraNumItems; numUsers = paraNumUsers; numRatings = paraNumRatings; userDegrees = new int[numUsers]; userStartingIndices = new int[numUsers + 1]; userAverageRatings = new double[numUsers]; itemDegrees = new int[numItems]; compressedRatingMatrix = new int[numRatings][3]; itemAverageRatings = new double[numItems]; predictions = new double[numRatings]; System.out.println(\"Reading \" + paraFilename); \/\/ Step 2. Read the data file. File tempFile = new File(paraFilename); if (!tempFile.exists()) { System.out.println(\"File \" + paraFilename + \" does not exists.\"); System.exit(0); } \/\/ Of if BufferedReader tempBufReader = new BufferedReader(new FileReader(tempFile)); String tempString; String[] tempStrArray; int tempIndex = 0; userStartingIndices[0] = 0; userStartingIndices[numUsers] = numRatings; while ((tempString = tempBufReader.readLine()) != null) { \/\/ Each line has three values tempStrArray = tempString.split(\",\"); compressedRatingMatrix[tempIndex][0] = Integer.parseInt(tempStrArray[0]); compressedRatingMatrix[tempIndex][1] = Integer.parseInt(tempStrArray[1]); compressedRatingMatrix[tempIndex][2] = Integer.parseInt(tempStrArray[2]); userDegrees[compressedRatingMatrix[tempIndex][0]]++; itemDegrees[compressedRatingMatrix[tempIndex][1]]++; if (tempIndex > 0) { \/\/ Starting to read the data of a new user. if (compressedRatingMatrix[tempIndex][0] != compressedRatingMatrix[tempIndex - 1][0]) { userStartingIndices[compressedRatingMatrix[tempIndex][0]] = tempIndex; } \/\/ Of if } \/\/ Of if tempIndex++; } \/\/ Of while tempBufReader.close(); double[] tempUserTotalScore = new double[numUsers]; double[] tempItemTotalScore = new double[numItems]; for (int i = 0; i < numRatings; i++) { tempUserTotalScore[compressedRatingMatrix[i][0]] += compressedRatingMatrix[i][2]; tempItemTotalScore[compressedRatingMatrix[i][1]] += compressedRatingMatrix[i][2]; } \/\/ Of for i for (int i = 0; i < numUsers; i++) { userAverageRatings[i] = tempUserTotalScore[i] \/ userDegrees[i]; } \/\/ Of for i for (int i = 0; i < numItems; i++) { itemAverageRatings[i] = tempItemTotalScore[i] \/ itemDegrees[i]; } \/\/ Of for i }\/\/ Of the first constructor <\/code><\/pre>\n

                \u8fd9\u90e8\u5206\u4ee3\u7801\u4e0d\u8981\u770b\u7740\u957f\uff0c\u5176\u5b9e\u5c31\u662f\u5bf9\u4e8etxt\u6587\u4ef6\u7684\u8bfb\u53d6\uff0c\u7136\u540e\u6309\u7167\u6211\u4eec\u6784\u9020\u7684\u6570\u636e\u7ed3\u6784\u8981\u6c42\uff0c\u5c06\u5176\u5b58\u50a8\u4e8e\u6211\u4eec\u7684\u6570\u636e\u7ed3\u6784\u4e2d\uff0c\u90fd\u662f\u5f88\u591a\u57fa\u672c\u64cd\u4f5c\u7684\u7ec4\u5408\u3002<\/p>\n

          \n
        1. 12~26\u884c \u56e0\u4e3a\u8f93\u5165\u7684\u76ee\u6807\u53c2\u6570\uff0c\u6545\u5bf9\u4e8e\u6570\u7ec4\u7b49\u6570\u636e\u7ed3\u6784\u7684\u521d\u59cb\u5316<\/li>\n
        2. 28~34\u884c \u5e38\u89c4\u7684Java\u8bfb\u6587\u4ef6\u4ee3\u7801\u3002\u7136\u540e\u4ece40\u884c\u5f00\u59cb\u89e3\u6790\u8bfb\u6307\u9488\uff0c\u9010\u884c\u83b7\u53d6\u6570\u636e\u3002<\/li>\n
        3. 43~48\u884c \u5b8c\u5584\u4e09\u5143\u7ec4\u77e9\u9635\u3001\u67d0\u7528\u6237\u770b\u7535\u5f71\u6570\u76ee\u7684\u7d2f\u52a0\u3001\u67d0\u7535\u5f71\u88ab\u591a\u5c11\u7528\u6237\u6240\u770b\u7684\u6570\u76ee\u7d2f\u52a0<\/li>\n
        4. 50~56\u884c \u5b8c\u5584 \u201c \u538b\u7f29\u77e9\u9635\u4e2d\u7528\u6237\u5f00\u59cb\u4e0b\u6807 \u201d \u6570\u7ec4<\/li>\n
        5. 60~72\u884c \u7528\u4ee5\u7edf\u8ba1\u67d0\u7528\u6237\u5168\u90e8\u8bc4\u5206\u7684\u5e73\u5747\u5206\u3001\u7edf\u8ba1\u67d0\u7535\u5f71\u5168\u90e8\u8bc4\u5206\u7684\u5e73\u5747\u5206\u3002\u8fd9\u91cc\u521b\u5efa\u4e86\u4e34\u65f6\u6570\u7ec4tempUserTotalScore\u4e0etempItemTotalScore\uff0c\u901a\u8fc7\u904d\u5386\u4e09\u5143\u7ec4\u77e9\u9635\u6765\u7edf\u8ba1\u5404\u7528\u6237\u4e0e\u5404\u7535\u5f71\u7684\u7684\u603b\u5206\u3002<\/li>\n<\/ol>\n

          2.M-distance\u7b97\u6cd5\u7684leave-one-out\u6d4b\u8bd5\u8fc7\u7a0b(\u6838\u5fc3)<\/h3>\n

                  \u5148\u8d34\u51fa\u5168\u90e8\u4ee3\u7801\uff1a<\/p>\n

           \/** ************************* * Leave-one-out prediction. The predicted values are stored in predictions. * * @see predictions ************************* *\/ public void leaveOneOutPrediction() { double tempItemAverageRating; \/\/ Make each line of the code shorter. int tempUser, tempItem, tempRating; System.out.println(\"\\r\\nLeaveOneOutPrediction for radius \" + radius); numNonNeighbors = 0; for (int i = 0; i < numRatings; i++) { tempUser = compressedRatingMatrix[i][0]; tempItem = compressedRatingMatrix[i][1]; tempRating = compressedRatingMatrix[i][2]; \/\/ Step 1. Recompute average rating of the current item. tempItemAverageRating = (itemAverageRatings[tempItem] * itemDegrees[tempItem] - tempRating) \/ (itemDegrees[tempItem] - 1); \/\/ Step 2. Recompute neighbors, at the same time obtain the ratings \/\/ Of neighbors. int tempNeighbors = 0; double tempTotal = 0; int tempComparedItem; for (int j = userStartingIndices[tempUser]; j < userStartingIndices[tempUser + 1]; j++) { tempComparedItem = compressedRatingMatrix[j][1]; if (tempItem == tempComparedItem) { continue;\/\/ Ignore itself. } \/\/ Of if if (Math.abs(tempItemAverageRating - itemAverageRatings[tempComparedItem]) < radius) { tempTotal += compressedRatingMatrix[j][2]; tempNeighbors++; } \/\/ Of if } \/\/ Of for j \/\/ Step 3. Predict as the average value of neighbors. if (tempNeighbors > 0) { predictions[i] = tempTotal \/ tempNeighbors; } else { predictions[i] = DEFAULT_RATING; numNonNeighbors++; } \/\/ Of if } \/\/ Of for i }\/\/ Of leaveOneOutPrediction<\/code><\/pre>\n

                  \u7136\u540e\u7ec6\u770b\u4e00\u4e9b\u7ec6\u8282\uff1a<\/p>\n

           tempUser = compressedRatingMatrix[i][0]; tempItem = compressedRatingMatrix[i][1]; tempRating = compressedRatingMatrix[i][2]; \/\/ Step 1. Recompute average rating of the current item. tempItemAverageRating = (itemAverageRatings[tempItem] * itemDegrees[tempItem] - tempRating) \/ (itemDegrees[tempItem] - 1);<\/code><\/pre>\n

                  \u9996\u5148\u5728\u83b7\u53d6\u4e86\u672c\u56de\u5408\u7684\u9488\u5bf9\u7528\u6237\u3001\u9488\u5bf9\u7535\u5f71\u3001\u6807\u51c6\u8bc4\u5206\uff08\u4fee\u6539\u524d\uff09\u4e4b\u540e\uff0c\u5c06\u5176\u4f5c\u4e3a\u6211\u4eec\u7684\u6d4b\u8bd5\u6570\u636e\uff08\u4e5f\u5c31\u662f\u6240\u8c13\u7684\u63a9\u76d6\u4f4f\u8fd9\u4e2a\u6570\u636e\uff0c\u5c06\u5176\u53d8\u6210\u672a\u77e5\u6570\u636e\uff0c\u5e76\u5bf9\u5b83\u9884\u6d4b\uff09\u3002\u5728\u8fd9\u4e4b\u524d\u9700\u8981\u5f97\u5230\u4fee\u6539\u5b83\u4e3a\u672a\u77e5\u6570\u636e\u4e4b\u540e\uff0c\u5b83\u5e73\u5747\u6570\\(r\\)\u7684\u53d8\u5316\u3002itemAverageRatings[tempItem] * itemDegrees[tempItem]\uff0c\u5373\u7535\u5f71\u7684\u5e73\u5747\u5206 * \u7535\u5f71\u8bc4\u5206\u4e2a\u6570\uff0c\u5f97\u5230\u7684\u662f\u8fd9\u4e2a\u7535\u5f71\u7684\u539f\u603b\u5206\u3002\u7136\u540e\u51cf\u53bb\u8bc4\u5206tempRating\uff0c\u5373\u5f97\u5230\u63a9\u76d6\u6389\u7528\u6237tempUser\u8bc4\u4ef7\u4e4b\u540e\u7684\u7535\u5f71\u603b\u8bc4\u5206\uff0c\u6700\u540e\u9664\u4ee5-1\u7684\u4eba\u6570\uff0c\u5373\u5f97\u5230\u4e86\u63a9\u76d6\u6389\u7528\u6237tempUser\u7684\u8bc4\u4ef7\u4e4b\u540e\u7535\u5f71tempItem\u7684\u8bc4\u5206\u3002\u8fd9\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u6570\u5b66\u9898\u3002<\/strong><\/p>\n

           \/\/ Step 2. Recompute neighbors, at the same time obtain the ratings \/\/ Of neighbors. int tempNeighbors = 0; double tempTotal = 0; int tempComparedItem; for (int j = userStartingIndices[tempUser]; j < userStartingIndices[tempUser + 1]; j++) { tempComparedItem = compressedRatingMatrix[j][1]; if (tempItem == tempComparedItem) { continue;\/\/ Ignore itself. } \/\/ Of if if (Math.abs(tempItemAverageRating - itemAverageRatings[tempComparedItem]) < radius) { tempTotal += compressedRatingMatrix[j][2]; tempNeighbors++; } \/\/ Of if } \/\/ Of for j<\/code><\/pre>\n

                  \u7136\u540e\u5c31\u662fkNN\u7684\u601d\u60f3\uff0c\u627e\u90bb\u5c45\u6765\u9884\u6d4b\u3002\u5728\u538b\u7f29\u7684\u4e09\u5143\u7ec4\u91cc\u9762\u600e\u4e48\u7167\u90bb\u5c45\uff1f<\/p>\n

                  \u9996\u5148\u660e\u767d\u5728\u6211\u4eec\u8fd9\u4e2aUser-Movie\u7a00\u758f\u77e9\u9635\u4e2d\u8c01\u662f\u6f5c\u5728\u7684\u90bb\u5c45\uff1a<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

                   \u5f53\u628a\\((u_0,m_2)\\)\u7ed9\u8bbe\u7f6e\u4e3a\u6d4b\u8bd5\u5bf9\u8c61\u540e\uff0c\u57fa\u4e8e\u7535\u5f71\u6765\u9884\u6d4b\uff0c\u90a3\u4e48\u6b64\u7528\u6237\u6ca1\u7528\u770b\u8fc7\u7684\u7535\u5f71\u5c31\u4e0d\u5e94\u5f53\u7eb3\u5165\u9884\u6d4b\uff0c\u53ea\u6709\u90a3\u4e9b\u8fd9\u4e2a\u7528\u6237\u770b\u8fc7\u7684\u7535\u5f71\u624d\u80fd\u4f5c\u4e3a\u6f5c\u5728\u90bb\u5c45\uff0c\u6240\u4ee5\u6211\u4eec\u5e94\u5f53\u904d\u5386\u8fd9\u4e2a\u7a00\u758f\u77e9\u9635\u7684\u7b2c\\(u_0\\)\u884c\u4e2d\u6240\u6709\u53c2\u4e0e\u4e86\u8bc4\u5206\u7684\u5143\u7d20\u3002<\/p>\n

                  \u600e\u4e48\u904d\u5386\u5462\uff1f\u4e09\u5143\u538b\u7f29\u5b58\u50a8\u5230\u538b\u7f29\u7684\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

                   \u53ef\u89c1 \u201c \u7b2c\\(u_0\\)\u884c\u4e2d\u6240\u6709\u53c2\u4e0e\u4e86\u8bc4\u5206\u7684\u5143\u7d20<\/strong><\/em> \u201d\u5c31\u662f\u4e09\u5143\u7ec4\u77e9\u9635\u7684\u7070\u8272\u90e8\u5206\uff0c\u5728\u538b\u7f29\u5b58\u50a8\u4e2d\uff0c\u8fd9\u90e8\u5206\u5143\u7d20\u5939\u5728\u5f53\u524d\\(u_0\\)\u7528\u6237\u9996\u6b21\u5728\u538b\u7f29\u5b58\u50a8\u4e2d\u51fa\u73b0\u7684\u4e0b\u6807\u4e0e\u4e0b\u4e00\u4e2a\u7528\u6237\\(u_1\\)\u4e4b\u95f4\u3002\u6240\u4ee5\u5f97\u51fa\u4e86\u4e0b\u9762\u8fd9\u6837\u7684for\u5faa\u73af\u3002<\/p>\n

          if (Math.abs(tempItemAverageRating - itemAverageRatings[tempComparedItem]) < radius) { tempTotal += compressedRatingMatrix[j][2]; tempNeighbors++; } \/\/ Of if<\/code><\/pre>\n

                  \u7136\u540e\u5224\u65ad\u5e73\u5747\u6570\u7684\u5dee\uff0c\u5e76\u4e0e\u9608\u503c\u6bd4\u8f83\uff1b\u5f53\u5c0f\u4e8e\u9608\u503c\u65f6\u5224\u65ad\u4e3a\u5408\u683c\u7684\u90bb\u5c45\uff0c\u7edf\u8ba1\u90bb\u5c45\u7684\u5206\u6570\u3002<\/p>\n

                  \u6267\u884c\u5b8c\u4e0a\u9762\u7684\u5faa\u73af\u4e4b\u540e\uff0c\u57fa\u672c\u7edf\u8ba1\u4e86\u90bb\u5c45\u7684\u603b\u5206\uff0c\u7531\u6b64\u8ba1\u7b97\u90bb\u5c45\u5e73\u5747\u503c\u4f5c\u4e3a\u4f30\u8ba1\u5206\uff08\u65e0\u90bb\u5c45\u5219\u8bbe\u7f6e\u7f3a\u7701\u503c\uff09\uff1a<\/p>\n

           \/\/ Step 3. Predict as the average value of neighbors. if (tempNeighbors > 0) { predictions[i] = tempTotal \/ tempNeighbors; } else { predictions[i] = DEFAULT_RATING; numNonNeighbors++; } \/\/ Of if<\/code><\/pre>\n

          3.\u7b97\u6cd5\u7684\u8bc4\u4ef7\u6307\u6807<\/h3>\n

          3.1 \u5e73\u5747\u7edd\u5bf9\u8bef\u5dee(Mean Abusolute Error: MAE)<\/strong><\/h4>\n

                  \u6240\u8c13\u7684\u8bef\u5dee\uff0c\u5373\u6211\u4eec\u5bf9\u4e8e\u5df2\u77e5\u7684\u4e00\u4e2aUser-Movie\u7a00\u758f\u56fe\u4e2d\u7684\u4e00\u4e2a\u6570\u636e\\(M(u_i,m_j) = x\\)\uff0c\u5c06\u5176\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u672a\u77e5\u7684\u6d4b\u8bd5\u96c6\uff0c\u505aleave-one-out\u7684\u9884\u6d4b\uff0c\u6700\u7ec8\u9884\u6d4b\u51fa\u7ed3\u679c\\(P(u_i,m_j) = y\\)\uff0c\u90a3\u4e48\u8bef\u5dee\u5c31\u662f\\(E_{i,j} = |x-y|\\)\u3002\u4e8e\u662f\u5e73\u5747\u7edd\u5bf9\u8bef\u5dee(Mean Abusolute Error)\u7684\u53ef\u5b9a\u4e49\u4e3a\u4e00\u4e2a\u57fa\u672c\u7684\u7b97\u672f\u5e73\u5747\uff08\\(u\u8868\u793a\u7528\u6237\u6570\uff0cm\u8868\u793a\u7535\u5f71\u6570\\)\uff09\uff1a\\[MAE = \\frac{\\sum_{i=1}^{u}\\sum_{i=1}^{m} E_{i,j}}{um}\\]<\/p>\n

           \/** ************************* * Compute the MAE based on the deviation of each leave-one-out. * * @author Fan Min ************************* *\/ public double computeMAE() throws Exception { double tempTotalError = 0; for (int i = 0; i < predictions.length; i++) { tempTotalError += Math.abs(predictions[i] - compressedRatingMatrix[i][2]); } \/\/ Of for i return tempTotalError \/ predictions.length; }\/\/ Of computeMAE<\/code><\/pre>\n

                   predictions[i]\u4e2d\u5b58\u5165\u7684\u662f\u6211\u4eec\u7684\u9884\u6d4b\u96c6\uff0c\u76f8\u5f53\u4e8e\u6211\u4e0a\u9762\u7684\\(P(u_i,m_j) = y\\)\uff0c\u53ea\u4e0d\u8fc7\u56e0\u4e3a\u5b83\u7684\u903b\u8f91\u8868\u793a\u662f\u538b\u7f29\u5b58\u50a8\u7ed3\u6784\uff0c\u6240\u4ee5\u8fd9\u91cc\u7684\u4e0b\u6807\\(i\\)\u662f\u7b97\u5f0f\u4e2d\\(i\\)\u4e0e\\(j\\)\u7684\u878d\u5408\u3002<\/p>\n

          3.2 \u5747\u65b9\u6839\u8bef\u5dee(Root Mean Square Error: RMSE)<\/strong><\/h4>\n

                  <\/strong>\u601d\u8def\u662f\u4e00\u6837\u7684\uff0c\u53ea\u4e0d\u8fc7\u6362\u4e86\u4e00\u79cd\u8bc4\u4ef7\u65b9\u6848\u800c\u5df2\uff0c\u8ba1\u7b97\u5982\u4e0b\uff1a\\[RMSE = \\sqrt \\frac{\\sum_{i=1}^{u}\\sum_{i=1}^{m} E_{i,j}^2}{um}\\]<\/p>\n

           \/** ************************* * Compute the RSME based on the deviation of each leave-one-out. * * @author Fan Min ************************* *\/ public double computeRSME() throws Exception { double tempTotalError = 0; for (int i = 0; i < predictions.length; i++) { tempTotalError += (predictions[i] - compressedRatingMatrix[i][2]) * (predictions[i] - compressedRatingMatrix[i][2]); } \/\/ Of for i double tempAverage = tempTotalError \/ predictions.length; return Math.sqrt(tempAverage); }\/\/ Of computeRSME<\/code><\/pre>\n

                  MAE\u80fd\u5f88\u597d\u53cd\u6620\u8bef\u5dee\u7684\u5b9e\u9645\u60c5\u51b5\uff0c\u800cRMSE\u4e3b\u8981\u662f\u53cd\u6620\u540c\u771f\u5b9e\u503c\u4e4b\u95f4\u7684\u504f\u5dee\uff0c\u4e00\u822c\u6765\u8bf4MAE\u503c\u8981\u6bd4RMSE\u5c0f\u5f97\u591a\uff0c\u7a81\u7136\u7684\u5cf0\u503c\u5f02\u5e38\u503c\u5c06\u4f1a\u5bf9\u4e8eRMSE\u7167\u6210\u8f83\u5927\u7684\u5f71\u54cd\uff0c\u800cMAE\u80fd\u76f8\u5bf9\u7a33\u5b9a\u3002 <\/p>\n

          \u56db\u3001\u8fd0\u884c\u6d4b\u8bd5\u4e0e\u6570\u636e\u5206\u6790<\/h2>\n

                  \u4e3b\u51fd\u6570\u90e8\u5206\uff1a<\/p>\n

           \/** ************************* * The entrance of the program. * * @param args Not used now. ************************* *\/ public static void main(String[] args) { try { MBR tempRecommender = new MBR(\"D:\/Java DataSet\/movielens-943u1682m.txt\", 943, 1682, ); for (double tempRadius = 0.2; tempRadius < 0.6; tempRadius += 0.1) { tempRecommender.setRadius(tempRadius); tempRecommender.leaveOneOutPrediction(); double tempMAE = tempRecommender.computeMAE(); double tempRSME = tempRecommender.computeRSME(); System.out.println(\"Radius = \" + tempRadius + \", MAE = \" + tempMAE + \", RSME = \" + tempRSME + \", numNonNeighbors = \" + tempRecommender.numNonNeighbors); } \/\/ Of for tempRadius } catch (Exception ee) { System.out.println(ee); } \/\/ Of try }\/\/ Of main }\/\/ Of class MBR<\/code><\/pre>\n

                  \u5728\u4e3b\u51fd\u6570\u4e2d\u6211\u4eec\u679a\u4e3e\u4e860.2\u30010.3\u30010.4\u30010.5\u56db\u79cd\u9608\u503c\uff0c\u5e76\u5206\u522b\u8fdb\u884cleave-one-out\u6d4b\u8bd5\uff0c\u7136\u540e\u8f93\u51fa\u4e24\u4e2a\u8bc4\u4ef7\u6307\u6807\u3002\u5f97\u5230\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

                   \u7b80\u5355\u6765\u770b\uff0cMAE\u4e0eRSME\u8bc4\u4ef7\u6307\u6807\u4e0b\uff0c\u82e5\u9608\u503c\u53d8\u5316\u8303\u56f4\u4e0d\u5927\u65f6\uff0c\u8bef\u5dee\u503c\u90fd\u76f8\u5bf9\u7a33\u5b9a\u5728\u4e00\u4e2a\u6bd4\u8f83\u4f4e\u7684\u8303\u56f4\uff0c\u4e0a\u9762\u8fd9\u4e2a\u56fe\u662f\u4e3b\u51fd\u6570\u4e2d\u7684\u8868\u793a\u3002\u82e5\u5938\u5927\u5faa\u73af\u7684\u8303\u56f4\uff0c\u9608\u503c\u7684\u9650\u5236\u53d8\u5f97\u5bbd\u677e\u65f6\uff0c\u66f4\u591a\u4e0d\u6070\u5f53\u7684\u7535\u5f71\u63a8\u8350\u4e86\u8fdb\u6765\u540e\uff0c\u8bef\u5dee\u503c\u4fbf\u9010\u6b65\u63d0\u9ad8\u3002\u4f46\u662f\u4ece\u8fd9\u4e2a\u56fe\u4e5f\u80fd\u53d1\u73b0\u4e00\u4e2a\u7ec6\u8282\uff0c\u5e76\u4e0d\u662f\u4e00\u5b9a\u5730\u8bf4\u9608\u503c\u662f\u8d8a\u5c0f\u8d8a\u597d\uff0c\u6b64\u56fe\u5728\u9608\u503c\u4ecb\u4e8e0.25\u52300.5\u4e4b\u95f4\u6709\u975e\u5e38\u660e\u663e\u7684\u504f\u5dee\u5c40\u90e8\u6700\u5c0f\uff0c\u6709\u4e0d\u663e\u8457\u7684\u5355\u8c03\u51cf\u533a\u95f4\u3002\u636e\u6211\u4e2a\u4eba\u63a8\u6d4b\u6765\u770b\uff0c\u6709\u53ef\u80fd\u662f\u8fc7\u5c0f\u7684\u9608\u503c\u5bfc\u81f4\u5ffd\u7565\u4e86\u67d0\u4e9b\u5173\u952e\u7535\u5f71\uff0c\u800c\u8fd9\u4e9b\u7535\u5f71\u51a5\u51a5\u4e4b\u4e2d\u53ef\u80fd\u4e0e\u6211\u4eec\u539f\u672c\u7684\u6807\u51c6\u6570\u636e\u6709\u8f83\u5f3a\u5173\u8054\u6027\u3002<\/p>\n

                  \u540c\u65f6\u4e5f\u80fd\u4e86\u89e3\u4e00\u4e2a\u73b0\u8c61\uff0cRSME\u867d\u7136\u76f8\u6bd4\u4e8eMAE\uff0c\u503c\u4f1a\u66f4\u5927\u4e00\u4e9b\uff0c\u53ef\u4ee5\u6709\u5229\u4e8e\u653e\u5927\u4e00\u4e9b\u4e0d\u663e\u8457\u7684\u7279\u5f81\uff0c\u4fbf\u4e8e\u5206\u6790\u4ee5\u53ca\u53d1\u73b0\u6570\u636e\u7684\u8fdb\u6b65\u7a7a\u95f4\u3002<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

                   \u6574\u4e2a\u7b97\u6cd5\u7684\u590d\u6742\u5ea6\u975e\u5e38\u660e\u663e\uff0cleave-one-out\u7167\u6210\u4e86\u6709\u6548\u8bc4\u5206\u7684\u53cc\u5faa\u73af\uff0c\u800c\u6bcf\u6b21\u5206\u6790\u90bb\u5c45\u9700\u8981\u8017\u65f6\u6700\u591a\\(O(M)\\)\uff08\\(M\\)\u4e3a\u7535\u5f71\u6570\u76ee\uff09\uff0c\u800c\u5355\u6b21\u5206\u6790\u90bb\u5c45\u53ea\u9700\u8981\\(O(1)\\)\u590d\u6742\u5ea6\u3002\u56e0\u6b64\uff0c\u603b\u7684\u590d\u6742\u5ea6\u4e3a\\(O(MN^2)\\)\uff08N\u4e3a\u6709\u6548\u8bc4\u5206\u603b\u6570\uff09\u3002<\/p>\n

          \u00b7 \u7b2c55\u5929\u5185\u5bb9\uff1a\u8865\u5145\u5b9e\u73b0user-based recommendation.<\/h2>\n

          1.\u601d\u7ef4\u8f6c\u53d8<\/h3>\n

                  \u6628\u5929\u6211\u4eec\u5b9e\u73b0\u7684\u662f\u57fa\u4e8e\u7535\u5f71\u5e73\u5747\u5206\u7684\u9884\u6d4b\uff0c\u4e5f\u5c31\u57fa\u4e8e\u5411\u91cf\\(\\vec m_i\\)\u7684\u8bc4\u5206\uff08\u770b\u5217\uff09\uff0c\u8fd9\u662f item-based recommendation\u3002\u800c\u4eca\u5929\u6539\u53d8\u601d\u8def\uff0c\u5b9e\u73b0user-based recommendation\u3002\u7b97\u6cd5\u601d\u8def\u662f\u4e00\u6837\uff0c\u53ea\u4e0d\u8fc7\u6211\u4eec\u6bd4\u5bf9\u7684\u5e73\u5747\u6570\u548c\u90bb\u5c45\u7684\u9009\u62e9\u4e0d\u540c\u4e86\u3002<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

                   \u4ecd\u968f\u673a\u63a9\u4f4f\u4e00\u4e2a\\((u_i,m_j)\\)\u8bbe\u7f6e\u4e3a\u672a\u77e5\u91cf\uff0c\u4f46\u662f\u8fd9\u6b21\u9009\u90bb\u5c45\u6211\u4eec\u662f\u9009\u62e9\u540c\u4e00\u90e8\u7535\u5f71<\/strong><\/em>\u7684\u6240\u6709\u7ed9\u51fa\u8bc4\u5206\u7684\u89c2\u4f17\uff0c\u5728\u8fd9\u4e9b\u6f5c\u5728\u90bb\u5c45\u2014\u2014\u7ed9\u51fa\u8bc4\u5206\u7684\u89c2\u4f17\u91cc\u9762\u9009\u62e9 \u7ed9\u6240\u6709\u7535\u5f71\u7684\u8bc4\u5206\u603b\u5e73\u5747<\/u> \u6700\u63a5\u8fd1\u7684\u9884\u6d4b\u6570\u636e\u5e73\u5747\u6570\u7684 \u89c2\u4f17\u3002\u5176\u5b9e\u5c31\u662f\u5c06\u539f\u6765\u770b\u5217\u5411\u91cf\u9009\u5b9a\u90bb\u5c45\u53d8\u4e3a\u770b\u884c\u5411\u91cf\u9009\u62e9\u90bb\u5c45\u3002<\/p>\n

                  \u90a3\u4e48\u8fd9\u4e2a\u600e\u4e48\u538b\u7f29\u5462\uff0c\u8fd9\u4e2a\u5c31\u4e0d\u80fd\u50cfitem-based recommendation\u90a3\u6837\u76f4\u63a5\u8bfb\u6211\u4eec\u7684\u6570\u636e\u96c6\u4e86\uff0c\u56e0\u4e3a\u6211\u4eec\u7684\u6570\u636e\uff08\u89c1\u4e0btxt\u6587\u6863\uff09\u662f\u57fa\u672c\u6309\u7167\u7528\u6237\u7f16\u53f7\u8fdb\u884c\u6392\u5e8f\u7684\u3002<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

                  \u5bf9\u4e8eUser * Movie\u7684\u7a00\u758f\u77e9\u9635\uff0c\u90a3\u4e48\u6211\u4eec\u7684\u6570\u636e\u5728\u903b\u8f91\u4e0a\u5c31\u662f\u5148\u884c\uff08\u7528\u6237\uff09\u540e\u5217\uff08\u7535\u5f71\uff09\u6392\u5217\u7684\u3002\u4e3e\u4e2a\u9c9c\u660e\u7684\u4f8b\u5b50\u5427\uff0c\u5982\u679c\u6211\u4eec\u7684\u4e09\u5143\u7ec4\u8868\u662f\uff1a<\/p>\n

          0 0 5 0 7 2 0 120 4 12 0 2 12 50 5 73 0 3 ...<\/code><\/pre>\n

                  \u90a3\u4e48\u987a\u5e8f\u8bbf\u95ee\u7684\u8bdd\uff0c\u5c31\u662f\u6309\u7167\u4e0b\u56fe\u8fd9\u6837\u5148\u884c\u540e\u5217\u5730\u904d\u5386<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

                   \u82e5\u6309\u7167\u8fd9\u6837\u8bbe\u7f6e\u538b\u7f29\u5b58\u50a8\uff0c\u90a3\u4e48\u540c\u4e2a\u7528\u6237\u7684\u6570\u636e\u4e00\u5b9a\u662f\u8fde\u7eed\u7684\uff0c\u800c\u540c\u4e00\u90e8\u7535\u5f71\u4e00\u5b9a\u4e0d\u8fde\u7eed\u3002\u8fd9\u5c31\u662f\u6211\u4eec\u8bbe\u7f6e \u7528\u6237\u5f00\u59cb\u4e0b\u6807\u6570\u7ec4<\/strong><\/u> <\/strong>\u7684\u539f\u56e0<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

                   \u82e5\u73b0\u5728\u6211\u4eec\u8981\u66f4\u65b9\u4fbf\u53d6\u5f97\u540c\u4e00\u90e8\u7535\u5f71\u7684\u5168\u90e8\u8bc4\u5206\uff0c\u800c\u975e\u4e00\u4e2a\u7528\u6237\u7684\u5168\u90e8\u8bc4\u5206\uff0c\u90a3\u4e48\u5c31\u8981\u6539\u53d8\u7b56\u7565\uff0c\u53d8\u4e3a\u884c\u4f18\u5148\u3002\u5982\u4f55\u505a\u5462\uff1f\u5176\u5b9e\u53ea\u8981\u6539\u53d8\u6211\u4eec\u9ed8\u8ba4\u6570\u636e\u7684\u6392\u5e8f\u89c4\u5219\u5c31\u597d\u4e86\uff1a\u6bd4\u5982\u6211\u521a\u521a\u4e3e\u7684\u8fd9\u4e2a\u4e09\u5143\u7ec4\u6570\u636e\u7684\u4f8b\u5b50\uff0c\u6211\u6765\u6309\u7167\u7535\u5f71\u6807\u53f7\u5c06\u5176\u6392\u5e8f\uff1a<\/p>\n

          0 0 5 12 0 2 73 0 3 0 7 2 12 50 5 0 120 4 ...<\/code><\/pre>\n

                  \u6392\u5e8f\u89c4\u5219\u53d8\u4e3a\u5148\u6309\u7167\u7b2c\u4e8c\u5217\u6392\u5e8f\uff0c\u6700\u540e\u518d\u6309\u7167\u7b2c\u4e00\u5217\u6392\u5e8f\u3002\u8fd9\u6837\u987a\u5e8f\u8bfb\u53d6\u5c31\u53d8\u6210\u4e86\u5148\u5217\uff08\u7535\u5f71\uff09\u540e\u884c\uff08\u7528\u6237\uff09\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u8fd9\u6837\u4f53\u73b0\u5728\u7ec6\u6570\u56fe\u4e0a\u7684\u904d\u5386\u4f1a\u662f\u4ec0\u4e48\u6837\u7684\u5462\uff1f<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

                   \u679c\u7136\u5b9e\u73b0\u4e86\u5217\u4f18\u5148\u7684\u904d\u5386\uff0c\u4e5f\u662f\u56e0\u4e3a\u5b9e\u73b0\u4e86\u5148\u5217\u5b58\u50a8\uff0c\u6240\u4ee5\u540c\u4e00\u90e8\u7535\u5f71\u7684\u8bc4\u5206\u90fd\u662f\u8fde\u7eed\u7684\u4e86\uff0c\u6240\u4ee5\u538b\u7f29\u5b58\u50a8\u4e4b\u540e\u5c31\u53ef\u4ee5\u975e\u5e38\u5bb9\u6613\u8bbe\u7f6e \u7535\u5f71\u5f00\u59cb\u4e0b\u6807<\/strong><\/u> \u6570\u7ec4\u3002\u8fd9\u6837\u5728\u5f97\u5230\u67d0\u4e2a\u672a\u77e5\u8bc4\u5206\u4e4b\u540e\u5c31\u80fd\u5f88\u5feb\u53d6\u51fa\u8fd9\u4e2a\u8bc4\u5206\u6240\u5728\u7684\u5217\u3002<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

                   \u4e0a\u8ff0\u7684\u8fd9\u4e2a\u8fc7\u7a0b\u6709\u4e2a\u5927\u5bb6\u90fd\u975e\u5e38\u719f\u6089\u7684\u540d\u79f0\uff1a\u8f6c\u7f6e\uff01<\/strong><\/span><\/em><\/u><\/p>\n

                  \u56e0\u6b64\uff0c\u6211\u4eec\u5c31\u5f97\u5230\u5b9e\u73b0item-based recommendtion\u7684\u65b9\u6848\u7b80\u56fe\uff1a<\/p>\n

                  \u5148\u5f97\u5230\u6309\u7167\u7528\u6237\u4f18\u5148\u7684\u4e09\u5143\u7ec4\u8868\uff0c\u7136\u540e\u6309\u7167\u7535\u5f71\u5217\u4f18\u5148\u5bf9\u4e8e\u8868\u8fdb\u884c\u91cd\u6392\uff0c\u7136\u540e\u7167\u5e38\u8bfb\u53d6\u8fd9\u4e2a\u8868\u8fdb\u884c\u538b\u7f29\u5b58\u50a8\u5373\u53ef\uff0c\u4f46\u662f\u8981\u6ce8\u610f\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\u4e00\u4e9b\u7ec6\u8282\u53d8\u91cf\u7684\u6539\u6362\u4f7f\u7528\uff01<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

          2.\u91cd\u5199\u7684\u6784\u9020\u51fd\u6570<\/h3>\n
           \/** ************************* * Construct the rating matrix. * * @param paraRatingFilename the rating filename. * @param paraNumUsers number of users * @param paraNumItems number of items * @param paraNumRatings number of ratings ************************* *\/ public MBR_userBased(String paraFilename, int paraNumUsers, int paraNumItems, int paraNumRatings) throws Exception { \/\/ Step 1. Initialize these arrays numItems = paraNumItems; numUsers = paraNumUsers; numRatings = paraNumRatings; userDegrees = new int[numUsers]; itemStartingIndices = new int[numItems + 1]; userAverageRatings = new double[numUsers]; itemDegrees = new int[numItems]; compressedRatingMatrix = new int[numRatings][3]; itemAverageRatings = new double[numItems]; predictions = new double[numRatings]; System.out.println(\"Reading \" + paraFilename); \/\/ Step 2. Read the data file. File tempFile = new File(paraFilename); if (!tempFile.exists()) { System.out.println(\"File \" + paraFilename + \" does not exists.\"); System.exit(0); } \/\/ Of if BufferedReader tempBufReader = new BufferedReader(new FileReader(tempFile)); String tempString; String[] tempStrArray; int tempIndex = 0; \/\/ Step 3. Read the data to compressedRatingMatrix and reorder while ((tempString = tempBufReader.readLine()) != null) { \/\/ Each line has three values tempStrArray = tempString.split(\",\"); compressedRatingMatrix[tempIndex][0] = Integer.parseInt(tempStrArray[0]); compressedRatingMatrix[tempIndex][1] = Integer.parseInt(tempStrArray[1]); compressedRatingMatrix[tempIndex][2] = Integer.parseInt(tempStrArray[2]); userDegrees[compressedRatingMatrix[tempIndex][0]]++; itemDegrees[compressedRatingMatrix[tempIndex][1]]++; tempIndex++; } \/\/ Of while tempBufReader.close(); \/\/ Reorder based on items Arrays.sort(compressedRatingMatrix, new Comparator<int[]>() { @Override public int compare(int[] o1, int[] o2) { if (o1[1] == o2[1]) return o1[0] - o2[0]; return o1[1] - o2[1]; }\/\/ Of compare }); \/\/ Step 4. Create Compressed Storage itemStartingIndices[0] = 0; itemStartingIndices[numItems] = numRatings; for (int k = 1; k < numRatings; k++) { \/\/ Starting to read the data of a new user. if (compressedRatingMatrix[k][1] != compressedRatingMatrix[k - 1][1]) { itemStartingIndices[compressedRatingMatrix[k][1]] = k; } \/\/ Of if } \/\/ Of while \/\/ Step 5. Calculate the average double[] tempUserTotalScore = new double[numUsers]; double[] tempItemTotalScore = new double[numItems]; for (int i = 0; i < numRatings; i++) { tempUserTotalScore[compressedRatingMatrix[i][0]] += compressedRatingMatrix[i][2]; tempItemTotalScore[compressedRatingMatrix[i][1]] += compressedRatingMatrix[i][2]; } \/\/ Of for i for (int i = 0; i < numUsers; i++) { userAverageRatings[i] = tempUserTotalScore[i] \/ userDegrees[i]; } \/\/ Of for i for (int i = 0; i < numItems; i++) { itemAverageRatings[i] = tempItemTotalScore[i] \/ itemDegrees[i]; } \/\/ Of for i }\/\/ Of the first constructor<\/code><\/pre>\n

                   \u6ce8\u610f\uff01\u56e0\u4e3a\u8981\u91cd\u6392\u6570\u636e\uff0c\u6240\u4ee5\u8fd9\u5c06\u539f\u6765\u662f\u4e00\u4e2a\u5faa\u73af\u5b8c\u6210\u7684\u8bfb\u6570\u636e\uff08Step 3\uff09\u4e0e\u538b\u7f29\u5b58\u50a8\uff08Step 4\uff09\u64cd\u4f5c\u5206\u5f00\u4e86\u3002\u91cd\u6392\u4ee3\u7801\u89c1\u4e0b\uff1a<\/p>\n

           \/\/ Reorder based on items Arrays.sort(compressedRatingMatrix, new Comparator<int[]>() { @Override public int compare(int[] o1, int[] o2) { if (o1[1] == o2[1]) return o1[0] - o2[0]; return o1[1] - o2[1]; }\/\/ Of compare });<\/code><\/pre>\n

          3.\u91cd\u5199\u7684leave-one-out\u7684\u6d4b\u8bd5\u4ee3\u7801<\/h3>\n
           \/** ************************* * Leave-one-out prediction. The predicted values are stored in predictions. * * @see predictions ************************* *\/ public void leaveOneOutPrediction() { double tempItemAverageRating; \/\/ Make each line of the code shorter. int tempUser, tempItem, tempRating; System.out.println(\"\\r\\nLeaveOneOutPrediction for radius \" + radius); numNonNeighbors = 0; for (int i = 0; i < numRatings; i++) { tempUser = compressedRatingMatrix[i][0]; tempItem = compressedRatingMatrix[i][1]; tempRating = compressedRatingMatrix[i][2]; \/\/ Step 1. Recompute average rating of the current item. tempItemAverageRating = (userAverageRatings[tempUser] * userDegrees[tempUser] - tempRating) \/ (userDegrees[tempUser] - 1); \/\/ Step 2. Recompute neighbors, at the same time obtain the ratings \/\/ Of neighbors. int tempNeighbors = 0; double tempTotal = 0; int tempComparedUser; for (int j = itemStartingIndices[tempItem]; j < itemStartingIndices[tempItem + 1]; j++) { tempComparedUser = compressedRatingMatrix[j][0]; if (tempUser == tempComparedUser) { continue;\/\/ Ignore itself. } \/\/ Of if if (Math.abs(tempItemAverageRating - userAverageRatings[tempComparedUser]) < radius) { tempTotal += compressedRatingMatrix[j][2]; tempNeighbors++; } \/\/ Of if } \/\/ Of for j \/\/ Step 3. Predict as the average value of neighbors. if (tempNeighbors > 0) { predictions[i] = tempTotal \/ tempNeighbors; } else { predictions[i] = DEFAULT_RATING; numNonNeighbors++; } \/\/ Of if } \/\/ Of for i }\/\/ Of leaveOneOutPrediction <\/code><\/pre>\n

                  \u539f\u65b9\u6cd5\u4e2d\u6ca1\u6709\u4f7f\u7528\u7684\u7528\u6237\u6570\u76eeuserDegrees\u4e0e\u7528\u6237\u5e73\u5747\u6570userAverageRatings\u5728\u8fd9\u4e2a\u6210\u4e3a\u4e86\u8ba1\u7b97\u7684\u4e3b\u89d2\uff0c\u601d\u8def\u6ca1\u53d8\uff0c\u53ea\u662f\u538b\u7f29\u6570\u7ec4\u7684\u4e0b\u6807\u8bbf\u95ee\u53d8\u91cf\u53d8\u4e86\uff0c\u8bb8\u591a\u57fa\u4e8e\u5217\u7684\u64cd\u4f5c\u6539\u4e3a\u57fa\u4e8e\u884c\u7684\u5373\u53ef\u3002<\/p>\n

          4.\u6570\u636e\u6d4b\u8bd5<\/h3>\n

                  \u4fee\u6539\u4e86\u4e4b\u540e\u6d4b\u8bd5\u8f93\u51fa\u5982\u4e0b\uff1a<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

          \"\u57fa\u4e8e<\/p>\n

                   \u5c31\u6570\u636e\u91cf\u6bd4\u8f83\u5c0f\u6765\u770b\uff0c\u57fa\u672c\u4e0a\u57fa\u4e8e\u7528\u6237\u7684\u63a8\u8350\u4e0e\u57fa\u4e8e\u7535\u5f71\u7684\u63a8\u8350\u662f\u5e73\u884c\u7684\uff0c\u8fd9\u662f\u7531\u7c7b\u4f3c\u7684\u65b9\u6cd5\u6240\u51b3\u5b9a\u7684\u3002\u4ece\u503c\u4e0a\u6765\u770b\uff0c\u57fa\u4e8e\u7528\u6237\u63a8\u8350\u7684\u8bef\u5dee\u4f1a\u9ad8\u4e00\u4e9b\u3002\u53ef\u80fd\u7684\u539f\u56e0\u662f\u7528\u6237\u7684\u6570\u76ee\uff08943\uff09\u8981\u5c0f\u4e8e\u7535\u5f71\u6570\u76ee\uff081682\uff09\u7684\u539f\u56e0\uff0c\u5728\u57fa\u4e8e\u7528\u6237\u7684\u63a8\u8350\u7cfb\u7edf\u4e2d\uff0c\u7528\u6237\u5c11\u5219\u5b66\u4e60\u6837\u672c\u91cf\u66f4\u5c11\uff0c\u5b66\u4e60\u7684\u91cf\u53ef\u80fd\u4e0d\u5b8c\u5168\u7cbe\u786e\u3002<\/p>\n

                  <\/p>\n

          \"\u57fa\u4e8e<\/p>\n

                   \u6709\u8da3\u7684\u5730\u65b9\u5728\u4e8e\u5f53\u6211\u4eec\u628a\u6570\u636e\u91cf\u6269\u5927\u540e\uff0c\u57fa\u4e8e\u7528\u6237\u8bc4\u5224\u7684\u63a8\u8350\u7cfb\u7edf\u4f3c\u4e4e\u5728\u5bf9\u4e8e\u9608\u503c\u5bbd\u677e\u73af\u5883\u4e0b\u8bef\u5dee\u7387\u4e0a\u5347\u7387\u5e76\u6ca1\u6709\u5f3a\u4e8e\u57fa\u4e8e\u7535\u5f71\u7684\u63a8\u8350\u7cfb\u7edf\uff0c\u751a\u81f3\u5728\u9ad8\u9608\u503c\uff08\u63a8\u8350\u7cfb\u7edf\u63a8\u8350\u9650\u5236\u4f4e\uff09\u7684\u73af\u5883\u4e0b\uff0c\u4f7f\u7528\u6837\u672c\u66f4\u5c11\u7684\u57fa\u4e8e\u7528\u6237\u7684\u63a8\u8350\u7cfb\u7edf\u80fd\u6709\u66f4\u4f4e\u7684\u8bef\u5dee\u3002\u4e5f\u8bb8\u8fd9\u4e0e\u7528\u6237\u6837\u672c\u91cf\u5c11\u7684\u5076\u53d1\u6027\u6709\u4e00\u5b9a\u7684\u5173\u7cfb\uff1f\u6216\u8005\u8bf4\u66f4\u5c11\u7684\u6837\u672c\u57fa\u6570\u4e5f\u964d\u4f4e\u4e86\u4e0d\u6ee1\u8db3\u9884\u6d4b\u8bc4\u5206\u7684\u9519\u8bef\u8bc4\u5206\u7684\u4e2a\u6570\uff0c\u4ece\u800c\u907f\u514d\u4e86\u8bef\u5dee\u4e0d\u4f1a\u4e0a\u5347\u5f97\u5f88\u5feb\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"\u57fa\u4e8e Java \u673a\u5668\u5b66\u4e60\u81ea\u5b66\u7b14\u8bb0 \uff08\u7b2c54-55\u5929\uff1a\u57fa\u4e8eM-distance\u7684\u63a8\u8350\u7cfb\u7edf\uff09\u6ce8\u610f\uff1a\u672c\u7bc7\u4e3a50\u5929\u540e\u7684Java\u81ea\u5b66\u7b14\u8bb0\u6269\u5145\uff0c\u5185\u5bb9\u4e0d\u518d\u662f\u57fa...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/4931"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=4931"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/4931\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=4931"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=4931"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=4931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}