{"id":248,"date":"2015-11-13T15:46:41","date_gmt":"2015-11-13T15:46:41","guid":{"rendered":""},"modified":"2015-11-13T15:46:41","modified_gmt":"2015-11-13T15:46:41","slug":"","status":"publish","type":"post","link":"http:\/\/weizn.net\/?p=248","title":{"rendered":"[\u8f6c] \u7528scikit-learn\u5b66\u4e60K-Means\u805a\u7c7b"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_17 counter-hierarchy\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" style=\"display: none;\"><i class=\"ez-toc-glyphicon ez-toc-icon-toggle\"><\/i><\/a><\/span><\/div>\n<nav><ul class=\"ez-toc-list ez-toc-list-level-1\"><li class=\"ez-toc-page-1 ez-toc-heading-level-1\"><a class=\"ez-toc-link ez-toc-heading-1\" href=\"http:\/\/weizn.net\/?p=248\/#1_K-Means%E7%B1%BB%E6%A6%82%E8%BF%B0\" title=\"\n\t1. K-Means\u7c7b\u6982\u8ff0 \n\">\n\t1. K-Means\u7c7b\u6982\u8ff0 \n<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-1\"><a class=\"ez-toc-link ez-toc-heading-2\" href=\"http:\/\/weizn.net\/?p=248\/#2_KMeans%E7%B1%BB%E4%B8%BB%E8%A6%81%E5%8F%82%E6%95%B0\" title=\"\n\t2.&nbsp;KMeans\u7c7b\u4e3b\u8981\u53c2\u6570 \n\">\n\t2.&nbsp;KMeans\u7c7b\u4e3b\u8981\u53c2\u6570 \n<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-1\"><a class=\"ez-toc-link ez-toc-heading-3\" href=\"http:\/\/weizn.net\/?p=248\/#3_MiniBatchKMeans%E7%B1%BB%E4%B8%BB%E8%A6%81%E5%8F%82%E6%95%B0\" title=\"\n\t3. MiniBatchKMeans\u7c7b\u4e3b\u8981\u53c2\u6570 \n\">\n\t3. MiniBatchKMeans\u7c7b\u4e3b\u8981\u53c2\u6570 \n<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-1\"><a class=\"ez-toc-link ez-toc-heading-4\" href=\"http:\/\/weizn.net\/?p=248\/#4_K%E5%80%BC%E7%9A%84%E8%AF%84%E4%BC%B0%E6%A0%87%E5%87%86\" title=\"\n\t4. K\u503c\u7684\u8bc4\u4f30\u6807\u51c6 \n\">\n\t4. K\u503c\u7684\u8bc4\u4f30\u6807\u51c6 \n<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-1\"><a class=\"ez-toc-link ez-toc-heading-5\" href=\"http:\/\/weizn.net\/?p=248\/#5_K-Means%E5%BA%94%E7%94%A8%E5%AE%9E%E4%BE%8B\" title=\"\n\t5.&nbsp;K-Means\u5e94\u7528\u5b9e\u4f8b \n\">\n\t5.&nbsp;K-Means\u5e94\u7528\u5b9e\u4f8b \n<\/a><\/li><\/ul><\/nav><\/div>\n<p>\n\t\u539f\u6587\uff1a<a href=\"http:\/\/www.cnblogs.com\/pinard\/p\/6169370.html\" target=\"_blank\">http:\/\/www.cnblogs.com\/pinard\/p\/6169370.html<\/a>\n<\/p>\n<p>\n\t\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u5728<a id=\"homepage1_HomePageDays_DaysList_ctl00_DayList_TitleUrl_0\" class=\"postTitle2\" href=\"http:\/\/www.cnblogs.com\/pinard\/p\/6164214.html\" style=\"margin:0px;padding:0px;color:#000000;\">K-Means\u805a\u7c7b\u7b97\u6cd5\u539f\u7406<\/a>\u4e2d\uff0c\u6211\u4eec\u5bf9K-Means\u7684\u539f\u7406\u505a\u4e86\u603b\u7ed3\uff0c\u672c\u6587\u6211\u4eec\u5c31\u6765\u8ba8\u8bba\u7528scikit-learn\u6765\u5b66\u4e60K-Means\u805a\u7c7b\u3002\u91cd\u70b9\u8bb2\u8ff0\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684k\u503c\u3002\n<\/p>\n<h1 style=\"margin:10px 0px;padding:0px;font-size:28px;line-height:1.5;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\"><span class=\"ez-toc-section\" id=\"1_K-Means%E7%B1%BB%E6%A6%82%E8%BF%B0\"><\/span>\n\t1. K-Means\u7c7b\u6982\u8ff0<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u5728scikit-learn\u4e2d\uff0c\u5305\u62ec\u4e24\u4e2aK-Means\u7684\u7b97\u6cd5\uff0c\u4e00\u4e2a\u662f\u4f20\u7edf\u7684K-Means\u7b97\u6cd5\uff0c\u5bf9\u5e94\u7684\u7c7b\u662fKMeans\u3002\u53e6\u4e00\u4e2a\u662f\u57fa\u4e8e\u91c7\u6837\u7684Mini Batch K-Means\u7b97\u6cd5\uff0c\u5bf9\u5e94\u7684\u7c7b\u662fMiniBatchKMeans\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u4f7f\u7528K-Means\u7684\u7b97\u6cd5\u8c03\u53c2\u662f\u6bd4\u8f83\u7b80\u5355\u7684\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u7528KMeans\u7c7b\u7684\u8bdd\uff0c\u4e00\u822c\u8981\u6ce8\u610f\u7684\u4ec5\u4ec5\u5c31\u662fk\u503c\u7684\u9009\u62e9\uff0c\u5373\u53c2\u6570n_clusters\uff1b\u5982\u679c\u662f\u7528MiniBatchKMeans\u7684\u8bdd\uff0c\u4e5f\u4ec5\u4ec5\u591a\u4e86\u9700\u8981\u6ce8\u610f\u8c03\u53c2\u7684\u53c2\u6570batch_size\uff0c\u5373\u6211\u4eec\u7684Mini Batch\u7684\u5927\u5c0f\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u5f53\u7136KMeans\u7c7b\u548cMiniBatchKMeans\u7c7b\u53ef\u4ee5\u9009\u62e9\u7684\u53c2\u6570\u8fd8\u6709\u4e0d\u5c11\uff0c\u4f46\u662f\u5927\u591a\u4e0d\u9700\u8981\u600e\u4e48\u53bb\u8c03\u53c2\u3002\u4e0b\u9762\u6211\u4eec\u5c31\u770b\u770bKMeans\u7c7b\u548cMiniBatchKMeans\u7c7b\u7684\u4e00\u4e9b\u4e3b\u8981\u53c2\u6570\u3002\n<\/p>\n<h1 style=\"margin:10px 0px;padding:0px;font-size:28px;line-height:1.5;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\"><span class=\"ez-toc-section\" id=\"2_KMeans%E7%B1%BB%E4%B8%BB%E8%A6%81%E5%8F%82%E6%95%B0\"><\/span>\n\t2.&nbsp;KMeans\u7c7b\u4e3b\u8981\u53c2\u6570<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\tKMeans\u7c7b\u7684\u4e3b\u8981\u53c2\u6570\u6709\uff1a\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t1)&nbsp;<strong style=\"margin:0px;padding:0px;\">n_clusters<\/strong>: \u5373\u6211\u4eec\u7684k\u503c\uff0c\u4e00\u822c\u9700\u8981\u591a\u8bd5\u4e00\u4e9b\u503c\u4ee5\u83b7\u5f97\u8f83\u597d\u7684\u805a\u7c7b\u6548\u679c\u3002k\u503c\u597d\u574f\u7684\u8bc4\u4f30\u6807\u51c6\u5728\u4e0b\u9762\u4f1a\u8bb2\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t2\uff09<strong style=\"margin:0px;padding:0px;\">max_iter<\/strong>\uff1a \u6700\u5927\u7684\u8fed\u4ee3\u6b21\u6570\uff0c\u4e00\u822c\u5982\u679c\u662f\u51f8\u6570\u636e\u96c6\u7684\u8bdd\u53ef\u4ee5\u4e0d\u7ba1\u8fd9\u4e2a\u503c\uff0c\u5982\u679c\u6570\u636e\u96c6\u4e0d\u662f\u51f8\u7684\uff0c\u53ef\u80fd\u5f88\u96be\u6536\u655b\uff0c\u6b64\u65f6\u53ef\u4ee5\u6307\u5b9a\u6700\u5927\u7684\u8fed\u4ee3\u6b21\u6570\u8ba9\u7b97\u6cd5\u53ef\u4ee5\u53ca\u65f6\u9000\u51fa\u5faa\u73af\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t3\uff09<strong style=\"margin:0px;padding:0px;\">n_init\uff1a<\/strong>\u7528\u4e0d\u540c\u7684\u521d\u59cb\u5316\u8d28\u5fc3\u8fd0\u884c\u7b97\u6cd5\u7684\u6b21\u6570\u3002\u7531\u4e8eK-Means\u662f\u7ed3\u679c\u53d7\u521d\u59cb\u503c\u5f71\u54cd\u7684\u5c40\u90e8\u6700\u4f18\u7684\u8fed\u4ee3\u7b97\u6cd5\uff0c\u56e0\u6b64\u9700\u8981\u591a\u8dd1\u51e0\u6b21\u4ee5\u9009\u62e9\u4e00\u4e2a\u8f83\u597d\u7684\u805a\u7c7b\u6548\u679c\uff0c\u9ed8\u8ba4\u662f10\uff0c\u4e00\u822c\u4e0d\u9700\u8981\u6539\u3002\u5982\u679c\u4f60\u7684k\u503c\u8f83\u5927\uff0c\u5219\u53ef\u4ee5\u9002\u5f53\u589e\u5927\u8fd9\u4e2a\u503c\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t4\uff09<strong style=\"margin:0px;padding:0px;\">init\uff1a&nbsp;<\/strong>\u5373\u521d\u59cb\u503c\u9009\u62e9\u7684\u65b9\u5f0f\uff0c\u53ef\u4ee5\u4e3a\u5b8c\u5168\u968f\u673a\u9009\u62e9&#8217;random&#8217;,\u4f18\u5316\u8fc7\u7684&#8217;k-means++&#8217;\u6216\u8005\u81ea\u5df1\u6307\u5b9a\u521d\u59cb\u5316\u7684k\u4e2a\u8d28\u5fc3\u3002\u4e00\u822c\u5efa\u8bae\u4f7f\u7528\u9ed8\u8ba4\u7684&#8217;k-means++&#8217;\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t5\uff09<strong style=\"margin:0px;padding:0px;\">algorithm<\/strong>\uff1a\u6709\u201cauto\u201d, \u201cfull\u201d or \u201celkan\u201d\u4e09\u79cd\u9009\u62e9\u3002&#8221;full&#8221;\u5c31\u662f\u6211\u4eec\u4f20\u7edf\u7684K-Means\u7b97\u6cd5\uff0c&nbsp;\u201celkan\u201d\u662f\u6211\u4eec\u539f\u7406\u7bc7\u8bb2\u7684elkan K-Means\u7b97\u6cd5\u3002\u9ed8\u8ba4\u7684&#8221;auto&#8221;\u5219\u4f1a\u6839\u636e\u6570\u636e\u503c\u662f\u5426\u662f\u7a00\u758f\u7684\uff0c\u6765\u51b3\u5b9a\u5982\u4f55\u9009\u62e9&#8221;full&#8221;\u548c\u201celkan\u201d\u3002\u4e00\u822c\u6570\u636e\u662f\u7a20\u5bc6\u7684\uff0c\u90a3\u4e48\u5c31\u662f&nbsp;\u201celkan\u201d\uff0c\u5426\u5219\u5c31\u662f&#8221;full&#8221;\u3002\u4e00\u822c\u6765\u8bf4\u5efa\u8bae\u76f4\u63a5\u7528\u9ed8\u8ba4\u7684&#8221;auto&#8221;\n<\/p>\n<h1 style=\"margin:10px 0px;padding:0px;font-size:28px;line-height:1.5;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\"><span class=\"ez-toc-section\" id=\"3_MiniBatchKMeans%E7%B1%BB%E4%B8%BB%E8%A6%81%E5%8F%82%E6%95%B0\"><\/span>\n\t3. MiniBatchKMeans\u7c7b\u4e3b\u8981\u53c2\u6570<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\tMiniBatchKMeans\u7c7b\u7684\u4e3b\u8981\u53c2\u6570\u6bd4KMeans\u7c7b\u7a0d\u591a\uff0c\u4e3b\u8981\u6709\uff1a\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t1)&nbsp;<strong style=\"margin:0px;padding:0px;\">n_clusters<\/strong>: \u5373\u6211\u4eec\u7684k\u503c\uff0c\u548cKMeans\u7c7b\u7684n_clusters\u610f\u4e49\u4e00\u6837\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t2\uff09<strong style=\"margin:0px;padding:0px;\">max_iter\uff1a<\/strong>\u6700\u5927\u7684\u8fed\u4ee3\u6b21\u6570\uff0c&nbsp;\u548cKMeans\u7c7b\u7684max_iter\u610f\u4e49\u4e00\u6837\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t3\uff09<strong style=\"margin:0px;padding:0px;\">n_init\uff1a<\/strong>\u7528\u4e0d\u540c\u7684\u521d\u59cb\u5316\u8d28\u5fc3\u8fd0\u884c\u7b97\u6cd5\u7684\u6b21\u6570\u3002\u8fd9\u91cc\u548cKMeans\u7c7b\u610f\u4e49\u7a0d\u6709\u4e0d\u540c\uff0cKMeans\u7c7b\u91cc\u7684n_init\u662f\u7528\u540c\u6837\u7684\u8bad\u7ec3\u96c6\u6570\u636e\u6765\u8dd1\u4e0d\u540c\u7684\u521d\u59cb\u5316\u8d28\u5fc3\u4ece\u800c\u8fd0\u884c\u7b97\u6cd5\u3002\u800cMiniBatchKMeans\u7c7b\u7684n_init\u5219\u662f\u6bcf\u6b21\u7528\u4e0d\u4e00\u6837\u7684\u91c7\u6837\u6570\u636e\u96c6\u6765\u8dd1\u4e0d\u540c\u7684\u521d\u59cb\u5316\u8d28\u5fc3\u8fd0\u884c\u7b97\u6cd5\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t<strong style=\"margin:0px;padding:0px;\"> <\/strong>4\uff09<strong style=\"margin:0px;padding:0px;\">batch_size<\/strong>\uff1a\u5373\u7528\u6765\u8dd1Mini Batch KMeans\u7b97\u6cd5\u7684\u91c7\u6837\u96c6\u7684\u5927\u5c0f\uff0c\u9ed8\u8ba4\u662f100.\u5982\u679c\u53d1\u73b0\u6570\u636e\u96c6\u7684\u7c7b\u522b\u8f83\u591a\u6216\u8005\u566a\u97f3\u70b9\u8f83\u591a\uff0c\u9700\u8981\u589e\u52a0\u8fd9\u4e2a\u503c\u4ee5\u8fbe\u5230\u8f83\u597d\u7684\u805a\u7c7b\u6548\u679c\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t5\uff09<strong style=\"margin:0px;padding:0px;\">init\uff1a&nbsp;<\/strong>\u5373\u521d\u59cb\u503c\u9009\u62e9\u7684\u65b9\u5f0f\uff0c\u548cKMeans\u7c7b\u7684init\u610f\u4e49\u4e00\u6837\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t6\uff09<strong style=\"margin:0px;padding:0px;\">init_size:&nbsp;<\/strong>\u7528\u6765\u505a\u8d28\u5fc3\u521d\u59cb\u503c\u5019\u9009\u7684\u6837\u672c\u4e2a\u6570\uff0c\u9ed8\u8ba4\u662fbatch_size\u76843\u500d\uff0c\u4e00\u822c\u7528\u9ed8\u8ba4\u503c\u5c31\u53ef\u4ee5\u4e86\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t7\uff09<strong style=\"margin:0px;padding:0px;\">reassignment_ratio:&nbsp;<\/strong>\u67d0\u4e2a\u7c7b\u522b\u8d28\u5fc3\u88ab\u91cd\u65b0\u8d4b\u503c\u7684\u6700\u5927\u6b21\u6570\u6bd4\u4f8b\uff0c\u8fd9\u4e2a\u548cmax_iter\u4e00\u6837\u662f\u4e3a\u4e86\u63a7\u5236\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u7684\u3002\u8fd9\u4e2a\u6bd4\u4f8b\u662f\u5360\u6837\u672c\u603b\u6570\u7684\u6bd4\u4f8b\uff0c\u4e58\u4ee5\u6837\u672c\u603b\u6570\u5c31\u5f97\u5230\u4e86\u6bcf\u4e2a\u7c7b\u522b\u8d28\u5fc3\u53ef\u4ee5\u91cd\u65b0\u8d4b\u503c\u7684\u6b21\u6570\u3002\u5982\u679c\u53d6\u503c\u8f83\u9ad8\u7684\u8bdd\u7b97\u6cd5\u6536\u655b\u65f6\u95f4\u53ef\u80fd\u4f1a\u589e\u52a0\uff0c\u5c24\u5176\u662f\u90a3\u4e9b\u6682\u65f6\u62e5\u6709\u6837\u672c\u6570\u8f83\u5c11\u7684\u8d28\u5fc3\u3002\u9ed8\u8ba4\u662f0.01\u3002\u5982\u679c\u6570\u636e\u91cf\u4e0d\u662f\u8d85\u5927\u7684\u8bdd\uff0c\u6bd4\u59821w\u4ee5\u4e0b\uff0c\u5efa\u8bae\u4f7f\u7528\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u6570\u636e\u91cf\u8d85\u8fc71w\uff0c\u7c7b\u522b\u53c8\u6bd4\u8f83\u591a\uff0c\u53ef\u80fd\u9700\u8981\u9002\u5f53\u51cf\u5c11\u8fd9\u4e2a\u6bd4\u4f8b\u503c\u3002\u5177\u4f53\u8981\u6839\u636e\u8bad\u7ec3\u96c6\u6765\u51b3\u5b9a\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t8\uff09<strong style=\"margin:0px;padding:0px;\">max_no_improvement\uff1a<\/strong>\u5373\u8fde\u7eed\u591a\u5c11\u4e2aMini Batch\u6ca1\u6709\u6539\u5584\u805a\u7c7b\u6548\u679c\u7684\u8bdd\uff0c\u5c31\u505c\u6b62\u7b97\u6cd5\uff0c \u548creassignment_ratio\uff0c<strong style=\"margin:0px;padding:0px;\">&nbsp;<\/strong>max_iter\u4e00\u6837\u662f\u4e3a\u4e86\u63a7\u5236\u7b97\u6cd5\u8fd0\u884c\u65f6\u95f4\u7684\u3002\u9ed8\u8ba4\u662f10.\u4e00\u822c\u7528\u9ed8\u8ba4\u503c\u5c31\u8db3\u591f\u4e86\u3002\n<\/p>\n<h1 style=\"margin:10px 0px;padding:0px;font-size:28px;line-height:1.5;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\"><span class=\"ez-toc-section\" id=\"4_K%E5%80%BC%E7%9A%84%E8%AF%84%E4%BC%B0%E6%A0%87%E5%87%86\"><\/span>\n\t4. K\u503c\u7684\u8bc4\u4f30\u6807\u51c6<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u4e0d\u50cf\u76d1\u7763\u5b66\u4e60\u7684\u5206\u7c7b\u95ee\u9898\u548c\u56de\u5f52\u95ee\u9898\uff0c\u6211\u4eec\u7684\u65e0\u76d1\u7763\u805a\u7c7b\u6ca1\u6709\u6837\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u6ca1\u6709\u6bd4\u8f83\u76f4\u63a5\u7684\u805a\u7c7b\u8bc4\u4f30\u65b9\u6cd5\u3002\u4f46\u662f\u6211\u4eec\u53ef\u4ee5\u4ece\u7c07\u5185\u7684\u7a20\u5bc6\u7a0b\u5ea6\u548c\u7c07\u95f4\u7684\u79bb\u6563\u7a0b\u5ea6\u6765\u8bc4\u4f30\u805a\u7c7b\u7684\u6548\u679c\u3002\u5e38\u89c1\u7684\u65b9\u6cd5\u6709\u8f6e\u5ed3\u7cfb\u6570Silhouette Coefficient\u548cCalinski-Harabasz Index\u3002\u4e2a\u4eba\u6bd4\u8f83\u559c\u6b22Calinski-Harabasz Index\uff0c\u8fd9\u4e2a\u8ba1\u7b97\u7b80\u5355\u76f4\u63a5\uff0c\u5f97\u5230\u7684Calinski-Harabasz\u5206\u6570\u503c<nobr aria-hidden=\"true\" style=\"margin:0px;padding:0px;transition:none;border:0px;max-width:none;max-height:none;min-width:0px;min-height:0px;vertical-align:0px;line-height:normal;\">s<\/nobr><span class=\"MJX_Assistive_MathML\" role=\"presentation\" style=\"margin:0px;padding:0px;top:0px;left:0px;clip:rect(1px, 1px, 1px, 1px);user-select:none;position:static;border:0px;display:inline;transition:none;vertical-align:0px;line-height:normal;height:1px !important;width:1px !important;overflow:hidden !important;\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><mi>s<\/mi><\/math><\/span>\u8d8a\u5927\u5219\u805a\u7c7b\u6548\u679c\u8d8a\u597d\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\tCalinski-Harabasz\u5206\u6570\u503c<nobr aria-hidden=\"true\" style=\"margin:0px;padding:0px;transition:none;border:0px;max-width:none;max-height:none;min-width:0px;min-height:0px;vertical-align:0px;line-height:normal;\">s<\/nobr><span class=\"MJX_Assistive_MathML\" role=\"presentation\" style=\"margin:0px;padding:0px;top:0px;left:0px;clip:rect(1px, 1px, 1px, 1px);user-select:none;position:static;border:0px;display:inline;transition:none;vertical-align:0px;line-height:normal;height:1px !important;width:1px !important;overflow:hidden !important;\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><mi>s<\/mi><\/math><\/span>\u7684\u6570\u5b66\u8ba1\u7b97\u516c\u5f0f\u662f\uff1a\n<\/p>\n<div class=\"MathJax_Display\" style=\"margin:1em 0em;padding:0px;text-align:center;position:relative;max-width:none;max-height:none;min-width:0px;min-height:0px;width:669px;\">\n\t<nobr aria-hidden=\"true\" style=\"margin:0px;padding:0px;transition:none;border:0px;max-width:none;max-height:none;min-width:0px;min-height:0px;vertical-align:0px;line-height:normal;\">s(k)=tr(Bk)tr(Wk)m\u2212kk\u22121<\/nobr><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><mi>s<\/mi><mo stretchy=\"false\">(<\/mo><mi>k<\/mi><mo stretchy=\"false\">)<\/mo><mo>=<\/mo><mfrac><mrow><mi>t<\/mi><mi>r<\/mi><mo stretchy=\"false\">(<\/mo><msub><mi>B<\/mi><mi>k<\/mi><\/msub><mo stretchy=\"false\">)<\/mo><\/mrow><mrow><mi>t<\/mi><mi>r<\/mi><mo stretchy=\"false\">(<\/mo><msub><mi>W<\/mi><mi>k<\/mi><\/msub><mo stretchy=\"false\">)<\/mo><\/mrow><\/mfrac><mfrac><mrow><mi>m<\/mi><mo>\u2212<\/mo><mi>k<\/mi><\/mrow><mrow><mi>k<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/mfrac><\/math>\n<\/div>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u5176\u4e2dm\u4e3a\u8bad\u7ec3\u96c6\u6837\u672c\u6570\uff0ck\u4e3a\u7c7b\u522b\u6570\u3002<nobr aria-hidden=\"true\" style=\"margin:0px;padding:0px;transition:none;border:0px;max-width:none;max-height:none;min-width:0px;min-height:0px;vertical-align:0px;line-height:normal;\">Bk<\/nobr><span class=\"MJX_Assistive_MathML\" role=\"presentation\" style=\"margin:0px;padding:0px;top:0px;left:0px;clip:rect(1px, 1px, 1px, 1px);user-select:none;position:static;border:0px;display:inline;transition:none;vertical-align:0px;line-height:normal;height:1px !important;width:1px !important;overflow:hidden !important;\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><msub><mi>B<\/mi><mi>k<\/mi><\/msub><\/math><\/span>\u4e3a\u7c7b\u522b\u4e4b\u95f4\u7684\u534f\u65b9\u5dee\u77e9\u9635\uff0c<nobr aria-hidden=\"true\" style=\"margin:0px;padding:0px;transition:none;border:0px;max-width:none;max-height:none;min-width:0px;min-height:0px;vertical-align:0px;line-height:normal;\">Wk<\/nobr><span class=\"MJX_Assistive_MathML\" role=\"presentation\" style=\"margin:0px;padding:0px;top:0px;left:0px;clip:rect(1px, 1px, 1px, 1px);user-select:none;position:static;border:0px;display:inline;transition:none;vertical-align:0px;line-height:normal;height:1px !important;width:1px !important;overflow:hidden !important;\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><msub><mi>W<\/mi><mi>k<\/mi><\/msub><\/math><\/span>\u4e3a\u7c7b\u522b\u5185\u90e8\u6570\u636e\u7684\u534f\u65b9\u5dee\u77e9\u9635\u3002<nobr aria-hidden=\"true\" style=\"margin:0px;padding:0px;transition:none;border:0px;max-width:none;max-height:none;min-width:0px;min-height:0px;vertical-align:0px;line-height:normal;\">tr<\/nobr><span class=\"MJX_Assistive_MathML\" role=\"presentation\" style=\"margin:0px;padding:0px;top:0px;left:0px;clip:rect(1px, 1px, 1px, 1px);user-select:none;position:static;border:0px;display:inline;transition:none;vertical-align:0px;line-height:normal;height:1px !important;width:1px !important;overflow:hidden !important;\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><mi>t<\/mi><mi>r<\/mi><\/math><\/span>\u4e3a\u77e9\u9635\u7684\u8ff9\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u4e5f\u5c31\u662f\u8bf4\uff0c\u7c7b\u522b\u5185\u90e8\u6570\u636e\u7684\u534f\u65b9\u5dee\u8d8a\u5c0f\u8d8a\u597d\uff0c\u7c7b\u522b\u4e4b\u95f4\u7684\u534f\u65b9\u5dee\u8d8a\u5927\u8d8a\u597d\uff0c\u8fd9\u6837\u7684Calinski-Harabasz\u5206\u6570\u4f1a\u9ad8\u3002\u5728scikit-learn\u4e2d\uff0c&nbsp;Calinski-Harabasz Index\u5bf9\u5e94\u7684\u65b9\u6cd5\u662fmetrics.calinski_harabaz_score.\n<\/p>\n<h1 style=\"margin:10px 0px;padding:0px;font-size:28px;line-height:1.5;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\"><span class=\"ez-toc-section\" id=\"5_K-Means%E5%BA%94%E7%94%A8%E5%AE%9E%E4%BE%8B\"><\/span>\n\t5.&nbsp;K-Means\u5e94\u7528\u5b9e\u4f8b<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u4e0b\u9762\u7528\u4e00\u4e2a\u5b9e\u4f8b\u6765\u8bb2\u89e3\u7528KMeans\u7c7b\u548cMiniBatchKMeans\u7c7b\u6765\u805a\u7c7b\u3002\u6211\u4eec\u89c2\u5bdf\u5728\u4e0d\u540c\u7684k\u503c\u4e0bCalinski-Harabasz\u5206\u6570\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u5b8c\u6574\u7684\u4ee3\u7801\u53c2\u89c1\u6211\u7684github: https:\/\/github.com\/ljpzzz\/machinelearning\/blob\/master\/classic-machine-learning\/kmeans_cluster.ipynb\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u9996\u5148\u6211\u4eec\u968f\u673a\u521b\u5efa\u4e00\u4e9b\u4e8c\u7ef4\u6570\u636e\u4f5c\u4e3a\u8bad\u7ec3\u96c6\uff0c\u9009\u62e9\u4e8c\u7ef4\u7279\u5f81\u6570\u636e\uff0c\u4e3b\u8981\u662f\u65b9\u4fbf\u53ef\u89c6\u5316\u3002\u4ee3\u7801\u5982\u4e0b\uff1a\n<\/p>\n<div class=\"cnblogs_code\" style=\"margin:5px 0px;padding:5px;background-color:#F5F5F5;border:1px solid #CCCCCC;overflow:auto;white-space:normal;font-family:&quot;\">\n<pre style=\"margin-top:0px;margin-bottom:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word;font-family:&quot;\"><span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">import<\/span><span style=\"margin:0px;padding:0px;line-height:1.5 !important;\"> numpy as np <\/span><span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">import<\/span><span style=\"margin:0px;padding:0px;line-height:1.5 !important;\"> matplotlib.pyplot as plt <\/span>%<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">matplotlib inline <\/span><span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">from<\/span> sklearn.datasets.samples_generator <span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">import<\/span><span style=\"margin:0px;padding:0px;line-height:1.5 !important;\"> make_blobs <\/span><span style=\"margin:0px;padding:0px;color:#008000;line-height:1.5 !important;\">#<\/span><span style=\"margin:0px;padding:0px;color:#008000;line-height:1.5 !important;\"> X\u4e3a\u6837\u672c\u7279\u5f81\uff0cY\u4e3a\u6837\u672c\u7c07\u7c7b\u522b\uff0c \u51711000\u4e2a\u6837\u672c\uff0c\u6bcf\u4e2a\u6837\u672c4\u4e2a\u7279\u5f81\uff0c\u51714\u4e2a\u7c07\uff0c\u7c07\u4e2d\u5fc3\u5728[-1,-1], [0,0],[1,1], [2,2]\uff0c \u7c07\u65b9\u5dee\u5206\u522b\u4e3a[0.4, 0.2, 0.2]<\/span> X, y = make_blobs(n_samples=1000, n_features=2, centers=[[-1,-1], [0,0], [1,1], [2,2]], cluster_std=[0.4, 0.2, 0.2, 0.2<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">], \r\n                  random_state <\/span>=9<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">)\r\nplt.scatter(X[:, 0], X[:, <\/span>1], marker=<span style=\"margin:0px;padding:0px;color:#800000;line-height:1.5 !important;\">'<\/span><span style=\"margin:0px;padding:0px;color:#800000;line-height:1.5 !important;\">o<\/span><span style=\"margin:0px;padding:0px;color:#800000;line-height:1.5 !important;\">'<\/span><span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">)\r\nplt.show()<\/span><\/pre>\n<\/div>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u4ece\u8f93\u51fa\u56fe\u53ef\u4ee5\u6211\u4eec\u770b\u770b\u6211\u4eec\u521b\u5efa\u7684\u6570\u636e\u5982\u4e0b\uff1a\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t<img decoding=\"async\" src=\"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/700e26421188522ee69439b62126567c20181113155139.png\" alt=\"\" style=\"margin:0px auto;padding:0px;max-width:660px;height:auto;display:block;\" \/>\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u73b0\u5728\u6211\u4eec\u6765\u7528K-Means\u805a\u7c7b\u65b9\u6cd5\u6765\u505a\u805a\u7c7b\uff0c\u9996\u5148\u9009\u62e9k=2\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a\n<\/p>\n<div class=\"cnblogs_code\" style=\"margin:5px 0px;padding:5px;background-color:#F5F5F5;border:1px solid #CCCCCC;overflow:auto;white-space:normal;font-family:&quot;\">\n<pre style=\"margin-top:0px;margin-bottom:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word;font-family:&quot;\"><span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">from<\/span> sklearn.cluster <span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">import<\/span><span style=\"margin:0px;padding:0px;line-height:1.5 !important;\"> KMeans\r\ny_pred <\/span>= KMeans(n_clusters=2, random_state=9<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">).fit_predict(X)\r\nplt.scatter(X[:, 0], X[:, <\/span>1], c=<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">y_pred)\r\nplt.show()<\/span><\/pre>\n<\/div>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\tk=2\u805a\u7c7b\u7684\u6548\u679c\u56fe\u8f93\u51fa\u5982\u4e0b\uff1a\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t<img decoding=\"async\" src=\"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/dedd028dbb48528608f37b160fab0d0820181113155139.png\" alt=\"\" style=\"margin:0px auto;padding:0px;max-width:660px;height:auto;display:block;\" \/>\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u73b0\u5728\u6211\u4eec\u6765\u770b\u770b\u6211\u4eec\u7528Calinski-Harabasz Index\u8bc4\u4f30\u7684\u805a\u7c7b\u5206\u6570:\n<\/p>\n<div class=\"cnblogs_code\" style=\"margin:5px 0px;padding:5px;background-color:#F5F5F5;border:1px solid #CCCCCC;overflow:auto;white-space:normal;font-family:&quot;\">\n<pre style=\"margin-top:0px;margin-bottom:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word;font-family:&quot;\"><span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">from<\/span> sklearn <span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">import<\/span><span style=\"margin:0px;padding:0px;line-height:1.5 !important;\"> metrics\r\nmetrics.calinski_harabaz_score(X, y_pred) <\/span><\/pre>\n<\/div>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u8f93\u51fa\u5982\u4e0b\uff1a\n<\/p>\n<pre style=\"margin-top:0px;margin-bottom:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word;background-color:#CFE8CB;\">3116.1706763322227<\/pre>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u73b0\u5728k=3\u6765\u770b\u770b\u805a\u7c7b\u6548\u679c\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a\n<\/p>\n<div class=\"cnblogs_code\" style=\"margin:5px 0px;padding:5px;background-color:#F5F5F5;border:1px solid #CCCCCC;overflow:auto;white-space:normal;font-family:&quot;\">\n<pre style=\"margin-top:0px;margin-bottom:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word;font-family:&quot;\"><span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">from<\/span> sklearn.cluster <span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">import<\/span><span style=\"margin:0px;padding:0px;line-height:1.5 !important;\"> KMeans\r\ny_pred <\/span>= KMeans(n_clusters=3, random_state=9<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">).fit_predict(X)\r\nplt.scatter(X[:, 0], X[:, <\/span>1], c=<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">y_pred)\r\nplt.show()<\/span> <\/pre>\n<\/div>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\tk=3\u7684\u805a\u7c7b\u7684\u6548\u679c\u56fe\u8f93\u51fa\u5982\u4e0b\uff1a\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t<img decoding=\"async\" src=\"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/4e04462c1034846071d68dd956ca421920181113155139.png\" alt=\"\" style=\"margin:0px auto;padding:0px;max-width:660px;height:auto;display:block;\" \/>\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u73b0\u5728\u6211\u4eec\u6765\u770b\u770b\u6211\u4eec\u7528Calinski-Harabaz Index\u8bc4\u4f30\u7684k=3\u65f6\u5019\u805a\u7c7b\u5206\u6570:\n<\/p>\n<div class=\"cnblogs_code\" style=\"margin:5px 0px;padding:5px;background-color:#F5F5F5;border:1px solid #CCCCCC;overflow:auto;white-space:normal;font-family:&quot;\">\n<pre style=\"margin-top:0px;margin-bottom:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word;font-family:&quot;\">metrics.calinski_harabaz_score(X, y_pred)  <\/pre>\n<\/div>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u8f93\u51fa\u5982\u4e0b\uff1a\n<\/p>\n<pre style=\"margin-top:0px;margin-bottom:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word;background-color:#CFE8CB;\">2931.625030199556<\/pre>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u53ef\u89c1\u6b64\u65f6k=3\u7684\u805a\u7c7b\u5206\u6570\u6bd4k=2\u8fd8\u5dee\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u73b0\u5728\u6211\u4eec\u770b\u770bk=4\u65f6\u5019\u7684\u805a\u7c7b\u6548\u679c\uff1a\n<\/p>\n<div class=\"cnblogs_code\" style=\"margin:5px 0px;padding:5px;background-color:#F5F5F5;border:1px solid #CCCCCC;overflow:auto;white-space:normal;font-family:&quot;\">\n<pre style=\"margin-top:0px;margin-bottom:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word;font-family:&quot;\"><span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">from<\/span> sklearn.cluster <span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">import<\/span><span style=\"margin:0px;padding:0px;line-height:1.5 !important;\"> KMeans\r\ny_pred <\/span>= KMeans(n_clusters=4, random_state=9<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">).fit_predict(X)\r\nplt.scatter(X[:, 0], X[:, <\/span>1], c=<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">y_pred)\r\nplt.show()<\/span><\/pre>\n<\/div>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\tk=4\u7684\u805a\u7c7b\u7684\u6548\u679c\u56fe\u8f93\u51fa\u5982\u4e0b\uff1a\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t<img decoding=\"async\" src=\"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/755249dc20e71588827f74d6ee2a123e20181113155139.png\" alt=\"\" style=\"margin:0px auto;padding:0px;max-width:660px;height:auto;display:block;\" \/>\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u73b0\u5728\u6211\u4eec\u6765\u770b\u770b\u6211\u4eec\u7528Calinski-Harabasz Index\u8bc4\u4f30\u7684k=4\u65f6\u5019\u805a\u7c7b\u5206\u6570:\n<\/p>\n<div class=\"cnblogs_code\" style=\"margin:5px 0px;padding:5px;background-color:#F5F5F5;border:1px solid #CCCCCC;overflow:auto;white-space:normal;font-family:&quot;\">\n<pre style=\"margin-top:0px;margin-bottom:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word;font-family:&quot;\">metrics.calinski_harabaz_score(X, y_pred)  <\/pre>\n<\/div>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u8f93\u51fa\u5982\u4e0b\uff1a\n<\/p>\n<pre style=\"margin-top:0px;margin-bottom:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word;background-color:#CFE8CB;\">5924.050613480169<\/pre>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u53ef\u89c1k=4\u7684\u805a\u7c7b\u5206\u6570\u6bd4k=2\u548ck=3\u90fd\u8981\u9ad8\uff0c\u8fd9\u4e5f\u7b26\u5408\u6211\u4eec\u7684\u9884\u671f\uff0c\u6211\u4eec\u7684\u968f\u673a\u6570\u636e\u96c6\u4e5f\u5c31\u662f4\u4e2a\u7c07\u3002\u5f53\u7279\u5f81\u7ef4\u5ea6\u5927\u4e8e2\uff0c\u6211\u4eec\u65e0\u6cd5\u76f4\u63a5\u53ef\u89c6\u5316\u805a\u7c7b\u6548\u679c\u6765\u8089\u773c\u89c2\u5bdf\u65f6\uff0c\u7528Calinski-Harabaz Index\u8bc4\u4f30\u662f\u4e00\u4e2a\u5f88\u5b9e\u7528\u7684\u65b9\u6cd5\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u73b0\u5728\u6211\u4eec\u518d\u770b\u770b\u7528MiniBatchKMeans\u7684\u6548\u679c\uff0c\u6211\u4eec\u5c06batch size\u8bbe\u7f6e\u4e3a200. \u7531\u4e8e\u6211\u4eec\u76844\u4e2a\u7c07\u90fd\u662f\u51f8\u7684\uff0c\u6240\u4ee5\u5176\u5b9ebatch size\u7684\u503c\u53ea\u8981\u4e0d\u662f\u975e\u5e38\u7684\u5c0f\uff0c\u5bf9\u805a\u7c7b\u7684\u6548\u679c\u5f71\u54cd\u4e0d\u5927\u3002\n<\/p>\n<div class=\"cnblogs_code\" style=\"margin:5px 0px;padding:5px;background-color:#F5F5F5;border:1px solid #CCCCCC;overflow:auto;white-space:normal;font-family:&quot;\">\n<pre style=\"margin-top:0px;margin-bottom:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word;font-family:&quot;\"><span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">for<\/span> index, k <span style=\"margin:0px;padding:0px;color:#0000FF;line-height:1.5 !important;\">in<\/span> enumerate((2,3,4,5<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">)):\r\n    plt.subplot(<\/span>2,2,index+1<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">)\r\n    y_pred <\/span>= MiniBatchKMeans(n_clusters=k, batch_size = 200, random_state=9<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">).fit_predict(X)\r\n    score<\/span>=<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\"> metrics.calinski_harabaz_score(X, y_pred)  \r\n    plt.scatter(X[:, 0], X[:, <\/span>1], c=<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">y_pred)\r\n    plt.text(.<\/span>99, .01, (<span style=\"margin:0px;padding:0px;color:#800000;line-height:1.5 !important;\">'<\/span><span style=\"margin:0px;padding:0px;color:#800000;line-height:1.5 !important;\">k=%d, score: %.2f<\/span><span style=\"margin:0px;padding:0px;color:#800000;line-height:1.5 !important;\">'<\/span> %<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\"> (k,score)),\r\n                 transform<\/span>=plt.gca().transAxes, size=10<span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">,\r\n                 horizontalalignment<\/span>=<span style=\"margin:0px;padding:0px;color:#800000;line-height:1.5 !important;\">'<\/span><span style=\"margin:0px;padding:0px;color:#800000;line-height:1.5 !important;\">right<\/span><span style=\"margin:0px;padding:0px;color:#800000;line-height:1.5 !important;\">'<\/span><span style=\"margin:0px;padding:0px;line-height:1.5 !important;\">)\r\nplt.show()<\/span><\/pre>\n<\/div>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u5bf9\u4e8ek=2,3,4,5\u5bf9\u5e94\u7684\u8f93\u51fa\u56fe\u4e3a\uff1a\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t<img decoding=\"async\" src=\"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/bb4c1278a0b9f80b7b22dda8c6fe0a6e20181113155139.png\" alt=\"\" style=\"margin:0px auto;padding:0px;max-width:660px;height:auto;display:block;\" \/>\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u53ef\u89c1\u4f7f\u7528MiniBatchKMeans\u7684\u805a\u7c7b\u6548\u679c\u4e5f\u4e0d\u9519\uff0c\u5f53\u7136\u7531\u4e8e\u4f7f\u7528Mini Batch\u7684\u539f\u56e0\uff0c\u540c\u6837\u662fk=4\u6700\u4f18\uff0cKMeans\u7c7b\u7684Calinski-Harabasz Index\u5206\u6570\u4e3a5924.05,\u800cMiniBatchKMeans\u7684\u5206\u6570\u7a0d\u5fae\u4f4e\u4e00\u4e9b\uff0c\u4e3a5921.45\u3002\u8fd9\u4e2a\u5dee\u5f02\u635f\u8017\u5e76\u4e0d\u5927\u3002\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t&nbsp;\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\uff08\u6b22\u8fce\u8f6c\u8f7d\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\u3002\u6b22\u8fce\u6c9f\u901a\u4ea4\u6d41\uff1a liujianping-ok@163.com\uff09\n<\/p>\n<p>\n\t\n<\/p>\n<p>\n\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\n\t\u539f\u6587\uff1a<a href=\"http:\/\/www.cnblogs.com\/pinard\/p\/6169370.html\" target=\"_blank\">http:\/\/www.cnblogs.com\/pinard\/p\/6169370.html<\/a>\n<\/p>\n<p>\n\t\n<\/p>\n<p>\n\t\n<\/p>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u5728<a id=\"homepage1_HomePageDays_DaysList_ctl00_DayList_TitleUrl_0\" class=\"postTitle2\" href=\"http:\/\/www.cnblogs.com\/pinard\/p\/6164214.html\" style=\"margin:0px;padding:0px;color:#000000;\">K-Means\u805a\u7c7b\u7b97\u6cd5\u539f\u7406<\/a>\u4e2d\uff0c\u6211\u4eec\u5bf9K-Means\u7684\u539f\u7406\u505a\u4e86\u603b\u7ed3\uff0c\u672c\u6587\u6211\u4eec\u5c31\u6765\u8ba8\u8bba\u7528scikit-learn\u6765\u5b66\u4e60K-Means\u805a\u7c7b\u3002\u91cd\u70b9\u8bb2\u8ff0\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684k\u503c\u3002\n<\/p>\n<h1 style=\"margin:10px 0px;padding:0px;font-size:28px;line-height:1.5;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t1. K-Means\u7c7b\u6982\u8ff0<br \/>\n<\/h1>\n<p style=\"margin:10px auto;padding:0px;font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal;background-color:#CFE8CB;\">\n\t\u5728scikit-learn\u4e2d\uff0c\u5305\u62ec\u4e24\u4e2aK-Means\u7684\u7b97\u6cd5\uff0c\u4e00\u4e2a\u662f\u4f20\u7edf\u7684K-Mean&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[337],"tags":[],"class_list":["post-248","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[\u8f6c] \u7528scikit-learn\u5b66\u4e60K-Means\u805a\u7c7b - Wayne&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/weizn.net\/?p=248\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[\u8f6c] \u7528scikit-learn\u5b66\u4e60K-Means\u805a\u7c7b - Wayne&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"\u539f\u6587\uff1ahttp:\/\/www.cnblogs.com\/pinard\/p\/6169370.html           \u5728K-Means\u805a\u7c7b\u7b97\u6cd5\u539f\u7406\u4e2d\uff0c\u6211\u4eec\u5bf9K-Means\u7684\u539f\u7406\u505a\u4e86\u603b\u7ed3\uff0c\u672c\u6587\u6211\u4eec\u5c31\u6765\u8ba8\u8bba\u7528scikit-learn\u6765\u5b66\u4e60K-Means\u805a\u7c7b\u3002\u91cd\u70b9\u8bb2\u8ff0\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684k\u503c\u3002    1. K-Means\u7c7b\u6982\u8ff0    \u5728scikit-learn\u4e2d\uff0c\u5305\u62ec\u4e24\u4e2aK-Means\u7684\u7b97\u6cd5\uff0c\u4e00\u4e2a\u662f\u4f20\u7edf\u7684K-Mean...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/weizn.net\/?p=248\" \/>\n<meta property=\"og:site_name\" content=\"Wayne&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-11-13T15:46:41+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/700e26421188522ee69439b62126567c20181113155139.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"zinan\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"http:\/\/weizn.net\/#website\",\"url\":\"http:\/\/weizn.net\/\",\"name\":\"Wayne&#039;s Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/weizn.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"ImageObject\",\"@id\":\"http:\/\/weizn.net\/?p=248#primaryimage\",\"inLanguage\":\"zh-Hans\",\"url\":\"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/700e26421188522ee69439b62126567c20181113155139.png\",\"contentUrl\":\"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/700e26421188522ee69439b62126567c20181113155139.png\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/weizn.net\/?p=248#webpage\",\"url\":\"http:\/\/weizn.net\/?p=248\",\"name\":\"[\\u8f6c] \\u7528scikit-learn\\u5b66\\u4e60K-Means\\u805a\\u7c7b - Wayne&#039;s Blog\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/weizn.net\/?p=248#primaryimage\"},\"datePublished\":\"2015-11-13T15:46:41+00:00\",\"dateModified\":\"2015-11-13T15:46:41+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/weizn.net\/?p=248#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/weizn.net\/?p=248\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/weizn.net\/?p=248#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\\u9996\\u9875\",\"item\":\"http:\/\/weizn.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[\\u8f6c] \\u7528scikit-learn\\u5b66\\u4e60K-Means\\u805a\\u7c7b\"}]},{\"@type\":\"Article\",\"@id\":\"http:\/\/weizn.net\/?p=248#article\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/?p=248#webpage\"},\"author\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"headline\":\"[\\u8f6c] \\u7528scikit-learn\\u5b66\\u4e60K-Means\\u805a\\u7c7b\",\"datePublished\":\"2015-11-13T15:46:41+00:00\",\"dateModified\":\"2015-11-13T15:46:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/weizn.net\/?p=248#webpage\"},\"wordCount\":231,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"image\":{\"@id\":\"http:\/\/weizn.net\/?p=248#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/700e26421188522ee69439b62126567c20181113155139.png\",\"articleSection\":[\"\\u6570\\u636e\\u5206\\u6790\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/weizn.net\/?p=248#respond\"]}]},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\",\"name\":\"zinan\",\"logo\":{\"@id\":\"http:\/\/weizn.net\/#personlogo\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[\u8f6c] \u7528scikit-learn\u5b66\u4e60K-Means\u805a\u7c7b - Wayne&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/weizn.net\/?p=248","og_locale":"zh_CN","og_type":"article","og_title":"[\u8f6c] \u7528scikit-learn\u5b66\u4e60K-Means\u805a\u7c7b - Wayne&#039;s Blog","og_description":"\u539f\u6587\uff1ahttp:\/\/www.cnblogs.com\/pinard\/p\/6169370.html           \u5728K-Means\u805a\u7c7b\u7b97\u6cd5\u539f\u7406\u4e2d\uff0c\u6211\u4eec\u5bf9K-Means\u7684\u539f\u7406\u505a\u4e86\u603b\u7ed3\uff0c\u672c\u6587\u6211\u4eec\u5c31\u6765\u8ba8\u8bba\u7528scikit-learn\u6765\u5b66\u4e60K-Means\u805a\u7c7b\u3002\u91cd\u70b9\u8bb2\u8ff0\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684k\u503c\u3002    1. K-Means\u7c7b\u6982\u8ff0    \u5728scikit-learn\u4e2d\uff0c\u5305\u62ec\u4e24\u4e2aK-Means\u7684\u7b97\u6cd5\uff0c\u4e00\u4e2a\u662f\u4f20\u7edf\u7684K-Mean...","og_url":"http:\/\/weizn.net\/?p=248","og_site_name":"Wayne&#039;s Blog","article_published_time":"2015-11-13T15:46:41+00:00","og_image":[{"url":"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/700e26421188522ee69439b62126567c20181113155139.png"}],"twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"zinan","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"http:\/\/weizn.net\/#website","url":"http:\/\/weizn.net\/","name":"Wayne&#039;s Blog","description":"","publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/weizn.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"ImageObject","@id":"http:\/\/weizn.net\/?p=248#primaryimage","inLanguage":"zh-Hans","url":"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/700e26421188522ee69439b62126567c20181113155139.png","contentUrl":"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/700e26421188522ee69439b62126567c20181113155139.png"},{"@type":"WebPage","@id":"http:\/\/weizn.net\/?p=248#webpage","url":"http:\/\/weizn.net\/?p=248","name":"[\u8f6c] \u7528scikit-learn\u5b66\u4e60K-Means\u805a\u7c7b - Wayne&#039;s Blog","isPartOf":{"@id":"http:\/\/weizn.net\/#website"},"primaryImageOfPage":{"@id":"http:\/\/weizn.net\/?p=248#primaryimage"},"datePublished":"2015-11-13T15:46:41+00:00","dateModified":"2015-11-13T15:46:41+00:00","breadcrumb":{"@id":"http:\/\/weizn.net\/?p=248#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/weizn.net\/?p=248"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/weizn.net\/?p=248#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/weizn.net\/"},{"@type":"ListItem","position":2,"name":"[\u8f6c] \u7528scikit-learn\u5b66\u4e60K-Means\u805a\u7c7b"}]},{"@type":"Article","@id":"http:\/\/weizn.net\/?p=248#article","isPartOf":{"@id":"http:\/\/weizn.net\/?p=248#webpage"},"author":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"headline":"[\u8f6c] \u7528scikit-learn\u5b66\u4e60K-Means\u805a\u7c7b","datePublished":"2015-11-13T15:46:41+00:00","dateModified":"2015-11-13T15:46:41+00:00","mainEntityOfPage":{"@id":"http:\/\/weizn.net\/?p=248#webpage"},"wordCount":231,"commentCount":0,"publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"image":{"@id":"http:\/\/weizn.net\/?p=248#primaryimage"},"thumbnailUrl":"http:\/\/www.weizn.net\/content\/uploadfile\/201811\/700e26421188522ee69439b62126567c20181113155139.png","articleSection":["\u6570\u636e\u5206\u6790"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/weizn.net\/?p=248#respond"]}]},{"@type":["Person","Organization"],"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264","name":"zinan","logo":{"@id":"http:\/\/weizn.net\/#personlogo"}}]}},"_links":{"self":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=248"}],"version-history":[{"count":0,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/248\/revisions"}],"wp:attachment":[{"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=248"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}