{"id":255,"date":"2018-11-17T16:10:10","date_gmt":"2018-11-17T16:10:10","guid":{"rendered":""},"modified":"2020-10-01T02:01:46","modified_gmt":"2020-09-30T18:01:46","slug":"%e8%bd%ac-python%e6%9c%ba%e5%99%a8%e5%ad%a6%e4%b9%a0%ef%bc%88sklearn%ef%bc%89-%e5%88%86%e7%b1%bb%e6%a8%a1%e5%9e%8b%e8%af%84%e4%bc%b0%e4%b8%8e%e8%b0%83%e5%8f%82%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"http:\/\/weizn.net\/?p=255","title":{"rendered":"[\u8f6c] Python\u673a\u5668\u5b66\u4e60\uff08sklearn\uff09\u2014\u2014\u5206\u7c7b\u6a21\u578b\u8bc4\u4f30\u4e0e\u8c03\u53c2\u603b\u7ed3"},"content":{"rendered":"<p style=\"box-sizing: border-box; margin-bottom: 12px;\"><span style=\"font-size: 14px;\"><span style=\"font-size: 16px;\">\u539f\u6587\uff1a<\/span><a href=\"https:\/\/ask.hellobi.com\/blog\/wangdawei\/12190\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-size: 16px;\">https:\/\/ask.hellobi.com\/blog\/wangdawei\/12190<\/span><\/a><\/span><\/p>\n<p style=\"box-sizing: border-box; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">1. \u5982\u679c\u53ea\u5212\u5206\u6d4b\u8bd5\u96c6\u548c\u8bad\u7ec3\u96c6\u00a0\u00a0\u00a0 \u7ecf\u9a8c\u662f75%\u4f5c\u4e3a\u8bad\u7ec3\u96c6\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">sklearn\u4e2d\u7684train_test_split()\u9ed8\u8ba4\u8fd9\u6837\u5212\u5206<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">from sklearn.model_selection import train_test_split<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">X_train, X_test, y_train, y_test = train_test_split()<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">2.\u00a0 \u901a\u5e38\u4f7f\u7528sklearn\u4e2d\u7684score\u65b9\u6cd5\u8ba1\u7b97\u7ed3\u679c\u7684\u7cbe\u5ea6\uff08\u6b63\u786e\u9884\u6d4b\u6bd4\u4f8b\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">3. KNN\u7b97\u6cd5\u6709\u4e24\u4e2a\u91cd\u8981\u53c2\u6570\uff1a\u90bb\u5c45\u4e2a\u6570\u548c\u6570\u636e\u70b9\u4e4b\u95f4\u8ddd\u79bb\u7684\u5ea6\u91cf\u65b9\u6cd5<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5728\u5b9e\u8df5\u4e2d\uff0c\u9009\u62e9\u8f83\u5c0f\u7684\u90bb\u5c45\u4e2a\u6570\uff08\u4f8b\u59823\u62165\u4e2a\uff09\u6548\u679c\u8f83\u597d\uff0csklearn\u4e2d\u9ed8\u8ba4\u4f7f\u7528\u6b27\u6c0f\u8ddd\u79bb<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u6784\u5efaKNN\u6a21\u578b\u901f\u5ea6\u5f88\u5feb\uff0c\u82e5\u8bad\u7ec3\u96c6\u5f88\u5927\uff08\u7279\u5f81\u6570\u591a\u6216\u6837\u672c\u6570\u591a\uff09\uff0c\u9884\u6d4b\u901f\u5ea6\u53ef\u80fd\u8f83\u6162<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5bf9\u4e8e\u7a00\u758f\u6570\u636e\u96c6\uff08\u5927\u591a\u6570\u7279\u5f81\u503c\u4e3a0\uff09\uff0cKNN\u6548\u679c\u5f88\u4e0d\u597d<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">4.\u666e\u901a\u6700\u5c0f\u4e8c\u4e58\u6cd5\uff0c\u5373\u8981\u6c42\u9884\u6d4b\u503c\u548c\u771f\u5b9e\u503c\u5747\u65b9\u8bef\u5dee\u6700\u5c0f<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5747\u65b9\u8bef\u5dee\u4e3a\u9884\u6d4b\u503c\u548c\u771f\u5b9e\u503c\u53ea\u5dee\u7684\u5e73\u65b9\u548c\u9664\u4ee5\u6837\u672c\u6570<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">5.\u8bad\u7ec3\u96c6\u548c\u6d4b\u8bd5\u96c6\u4e4b\u95f4\u7684\u5206\u6570\u5dee\u5f02\u662f\u8fc7\u62df\u5408\u7684\u660e\u663e\u6807\u5fd7<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u4f8b\u5982\uff0c\u8bad\u7ec3\u96c60.95\u00a0\u00a0 \u6d4b\u8bd5\u96c60.61<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">6.\u7ebf\u6027\u56de\u5f52\u9632\u6b62\u8fc7\u62df\u5408\u53ef\u4ee5\u91c7\u7528\u5cad\u56de\u5f52\uff08L2\u6b63\u5219\u5316\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">from sklearn,linear_model import Ridge<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">ridge = Ridge().fit(X_train,y_train)<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u7ebf\u6027\u56de\u5f52\u4e2d\u7684score\u4e3aR^2<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5cad\u56de\u5f52\u7684\u7ed3\u679c\uff0c\u8bad\u7ec3\u96c6\u5206\u6570\u53ef\u80fd\u4f4e\u4e8e\u7ebf\u6027\u56de\u5f52\uff0c\u4f46\u6d4b\u8bd5\u96c6\u5206\u6570\u4e00\u822c\u9ad8\u4e8e\u7ebf\u6027\u56de\u5f52<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u9ed8\u8ba4\u5cad\u56de\u5f52\u7684alpha = 1.0<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5cad\u56de\u5f52\u60e9\u7f5a\u4e86\u7cfb\u6570\u7684L2\u8303\u6570\u6216w\u7684\u6b27\u5f0f\u957f\u5ea6<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u589e\u5927alpha\u4f1a\u4f7f\u5f97\u5404\u4e2a\u7cfb\u6570wi\u66f4\u52a0\u8d8b\u54110\uff0c\u4ece\u800c\u63d0\u9ad8\u6cdb\u5316\u6027\u80fd<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u53ef\u4ee5\u6bd4\u8f83alpha\u4e3a10 \u548c 0.1\u7684scores<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5f53\u5cad\u56de\u5f52alpha = 0\u65f6\uff0c\u5373\u7ebf\u6027\u56de\u5f52<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">7. \u5b66\u4e60\u66f2\u7ebf\uff1a\u56de\u5f52\u95ee\u9898\u4e2d\uff0c\u6a2a\u8f74\u4e3a\u8bad\u7ec3\u96c6\u5927\u5c0f\uff0c\u7eb5\u8f74\u4e3ascore(R^2)\uff0c\u7ed8\u5236\u8bad\u7ec3\u96c6\u548c\u6d4b\u8bd5\u96c6\u66f2\u7ebf<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">8. \u5982\u679c\u6709\u8db3\u591f\u591a\u7684\u6570\u636e\uff0c\u6b63\u5219\u5316\u5c31\u4e0d\u592a\u91cd\u8981\u4e86<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">9.\u7ebf\u6027\u56de\u5f52\u9632\u6b62\u8fc7\u62df\u5408\u53ef\u4ee5\u91c7\u7528Lasso\u56de\u5f52\uff08L1\u6b63\u5219\u5316\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u56e0\u4e3aLasso\u4f1a\u4f7f\u5f97\u90e8\u5206\u7279\u5f81\u7684\u7cfb\u6570\uff08w\uff09\u4e3a0\uff0c\u6240\u4ee5\u76f8\u5f53\u4e8e\u505a\u7279\u5f81\u7b5b\u9009<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u53ea\u5448\u73b0\u91cd\u8981\u7684\u7279\u5f81<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">from sklearn,linear_model import Lasso<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">ridge = Lasso().fit(X_train,y_train)<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u9ed8\u8ba4\u7684alpha = 1<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u53ef\u80fd\u4f1a\u6b20\u62df\u5408\uff08\u8bad\u7ec3\u96c6\u548c\u6d4b\u8bd5\u96c6\u7684score\u90fd\u4e0d\u9ad8\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u6211\u4eec\u6b64\u65f6\u5e94\u8be5\u51cf\u5c0falpha\uff0c\u589e\u5927max_iter\uff08\u8fd0\u884c\u8fed\u4ee3\u7684\u6700\u5927\u6b21\u6570\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">from sklearn,linear_model import Lasso<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">ridge = Lasso(alpha = 0.1\uff0cmax_iter = 100000).fit(X_train,y_train)<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5982\u679calpha\u592a\u5c0f\uff0c\u5219\u53ef\u80fd\u8fc7\u62df\u5408\uff0c\u5373\u4e0e\u7ebf\u6027\u56de\u5f52\u6548\u679c\u76f8\u4f3c<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">10. Lasso\u56de\u5f52\u548c\u5cad\u56de\u5f52\u4e00\u822c\u4f1a\u9996\u9009\u540e\u8005<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5982\u679c\u7279\u5f81\u5f88\u591a\uff0c\u8ba4\u4e3a\u53ea\u6709\u51e0\u4e2a\u662f\u91cd\u8981\u7684\uff0c\u5219\u9009\u62e9Lasso<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5982\u679c\u4e3a\u4e86\u6a21\u578b\u7684\u53ef\u89e3\u91ca\u6027\uff0c\u9009\u62e9Lasso\uff08\u56e0\u4e3a\u7c7b\u4f3c\u7279\u5f81\u9009\u62e9\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">11.sklearn\u4e2d\u903b\u8f91\u56de\u5f52\u548c\u7ebf\u6027\u652f\u6301\u5411\u91cf\u673a\u90fd\u9ed8\u8ba4\u4f7f\u7528L2\u6b63\u5219\u5316<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u82e5\u6362\u4e3aL1\u6b63\u5219\u5316\uff1a<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">LogisticRegression\uff08penalty = &#8220;l1&#8221;).fit(X_train,y_train)<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u4f7f\u7528\u53c2\u6570C\u8868\u793a\u6b63\u5219\u5316\u5f3a\u5ea6\uff0cC\u8d8a\u5c0f\uff0c\u6b63\u5219\u5316\u8d8a\u5f3a\u3002<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u9ed8\u8ba4C=1<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">LogisticRegression(C=100).fit(X_train,y_train)<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u6709\u65f6\u8bad\u7ec3\u96c6\u6d4b\u8bd5\u96c6\u5206\u6570\u90fd\u5f88\u9ad8\uff0c\u4f46\u662f\u5206\u6570\u63a5\u8fd1\uff0c\u53ef\u80fd\u662f\u6b20\u62df\u5408<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u6b64\u65f6\u589e\u5927C\uff0c\u4f7f\u6b63\u5219\u5316\u51cf\u5f31\u770b\u770b\u7ed3\u679c\u5206\u6570<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">12.\u7ebf\u6027\u6a21\u578b\u8bad\u7ec3\u901f\u5ea6\u975e\u5e38\u5feb\uff0c\u9884\u6d4b\u901f\u5ea6\u4e5f\u5f88\u5feb\uff0c\u9002\u5408\u5728\u5927\u6570\u636e\u96c6\u4e0a\u4f7f\u7528\uff0c\u4e5f\u9002\u5408\u7a00\u758f\u6570\u636e<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">13.\u6734\u7d20\u8d1d\u53f6\u65af\u5206\u7c7b\u5668\u901f\u5ea6\u66f4\u5feb\uff08\u76f8\u6bd4\u4e8e\u7ebf\u6027\u5206\u7c7b\u5668\u903b\u8f91\u65af\u7279\u56de\u5f52\u548c\u7ebf\u6027\u652f\u6301\u5411\u91cf\u673a\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u4f46\u662f\u5176\u6cdb\u5316\u80fd\u529b\u6bd4\u7ebf\u6027\u5206\u7c7b\u5668\u5dee<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">14.sklearn\u4e2d\u63d0\u4f9b\u4e09\u79cd\u6734\u7d20\u8d1d\u53f6\u65af\u5206\u7c7b\u5668<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">GaussianNB\u8bfe\u7528\u4e8e\u4efb\u610f\u8fde\u7eed\u6570\u636e<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">BernoulliNB\u5047\u5b9a\u8f93\u5165\u6570\u636e\u4e3a\u4e8c\u5206\u7c7b\u6570\u636e<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">MultinomialNB\u5047\u5b9a\u8f93\u5165\u7684\u6570\u636e\u4e3a\u8ba1\u6570\u6570\u636e\uff08\u5373\u6bcf\u4e2a\u7279\u5f81\u4ee3\u8868\u67d0\u4e2a\u5bf9\u8c61\u7684\u6574\u6570\u8ba1\u6570\uff0c\u6bd4\u5982\u4e00\u4e2a\u5355\u8bcd\u5728\u53e5\u4e2d\u51fa\u73b0\u7684\u6b21\u6570\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u540e\u4e24\u4e2a\u4e3b\u8981\u7528\u4e8e\u6587\u672c\u5206\u7c7b<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">15.\u51b3\u7b56\u6811\u4e5f\u53ef\u7528\u4e8e\u56de\u5f52\u4efb\u52a1\uff0c\u9884\u6d4b\u65f6\u57fa\u4e8e\u6bcf\u4e2a\u8282\u70b9\u7684\u6d4b\u8bd5\u5bf9\u6811\u8fdb\u884c\u904d\u5386\uff0c\u6700\u7ec8\u627e\u5230\u65b0\u6570\u636e\u70b9\u6240\u5c5e\u7684\u53f6\u8282\u70b9<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u8fd9\u4e00\u6570\u636e\u70b9\u7684\u8f93\u51fa\u5373\u4e3a\u6b64\u53f6\u8282\u70b9\u4e2d\u6240\u6709\u8bad\u7ec3\u70b9\u7684\u5e73\u5747\u76ee\u6807\u503c\u3002<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">16. \u51b3\u7b56\u6811\u53ef\u4ee5\u91c7\u7528\u9884\u526a\u679d\u548c\u540e\u526a\u679d\u6765\u9632\u6b62\u8fc7\u62df\u5408<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">sklearn\u4e2d\u53ea\u5b9e\u73b0\u4e86\u9884\u526a\u679d<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u9884\u526a\u679d\u9650\u5236\u6761\u4ef6\u53ef\u4ee5\u5305\u62ec<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u9650\u5236\u6811\u7684\u6700\u5927\u6df1\u5ea6<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u9650\u5236\u53f6\u8282\u70b9\u7684\u6700\u5927\u6570\u76ee<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u89c4\u5b9a\u4e00\u4e2a\u8282\u70b9\u4e2d\u6570\u636e\u70b9\u7684\u6700\u5c0f\u6570\u76ee\u9632\u6b62\u7ee7\u7eed\u5212\u5206<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">17.\u51b3\u7b56\u6811graphviz\u53ef\u89c6\u5316\u56fe\u4e2d\u7684samples\u7ed9\u51fa\u8be5\u8282\u70b9\u4e2d\u7684\u6837\u672c\u6570<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">values\u7ed9\u51fa\u6bcf\u4e2a\u7c7b\u522b\u7684\u6837\u672c\u6570<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">18.\u7279\u5f81\u91cd\u8981\u6027\u6307\u6807\u53ef\u4ee5\u770b\u51b3\u7b56\u6811\u7684\u7279\u5f81\u91cd\u8981\u6027\uff0c\u6bcf\u4e2a\u7279\u5f81\u503c\u4ecb\u4e8e0\u548c1\u4e4b\u95f4<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">tree.feature_importance_<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u4e14\u52a0\u548c\u4e3a1<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">0\u8868\u793a\u7279\u5f81\u6ca1\u7528\u5230<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">1\u8868\u793a\u5b8c\u7f8e\u9884\u6d4b\u76ee\u6807\u503c<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">19.\u51b3\u7b56\u6811\u56de\u5f52\u4e0d\u80fd\u5916\u63a8\uff0c\u4e5f\u4e0d\u80fd\u5728\u8bad\u7ec3\u6570\u636e\u8303\u56f4\u4e4b\u5916\u8fdb\u884c\u9884\u6d4b<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">20. \u51b3\u7b56\u6811\u4f18\u70b9\uff1a<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\uff081\uff09\u8f83\u5c0f\u7684\u6811\u6a21\u578b\u53ef\u89c6\u5316\u5bb9\u6613\uff0c\u5bb9\u6613\u89e3\u91ca\u7406\u89e3<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\uff082\uff09\u7b97\u6cd5\u4e0d\u53d7\u6570\u636e\u7f29\u653e\u5f71\u54cd\uff08\u56e0\u4e3a\u6bcf\u4e2a\u7279\u5f81\u5355\u72ec\u5904\u7406\uff09\uff0c\u7279\u5f81\u4e0d\u9700\u8981\u9884\u5904\u7406\uff08\u5f52\u4e00\u5316 \u6807\u51c6\u5316\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u7279\u522b\u662f\u7279\u5f81\u5c3a\u5ea6\u5927\u5c0f\u76f8\u5dee\u5927\u6216\u8005\u4e8c\u5143\u7279\u5f81\u548c\u8fde\u7eed\u7279\u5f81\u540c\u65f6\u5b58\u5728\u65f6<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u51b3\u7b56\u6811\u7f3a\u70b9\uff1a<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u65e2\u4f7f\u9884\u526a\u679d\uff0c\u4e5f\u7ecf\u5e38\u8fc7\u62df\u5408\uff0c\u6cdb\u5316\u80fd\u529b\u5dee\uff0c\u6240\u4ee5\u5927\u591a\u6570\u60c5\u51b5\u91c7\u7528\u96c6\u6210\u6a21\u578b\u4ee3\u66ff\u5355\u68f5\u51b3\u7b56\u6811\u3002<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">21.\u00a0 \u96c6\u6210\u65b9\u6cd5\u6709\u968f\u673a\u68ee\u6797\uff08random forest\uff09\u548c\u68af\u5ea6\u63d0\u5347\u6811\uff08gradient boosted decision tree\uff09GBDT<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u968f\u673a\u68ee\u6797\u4e2d\u6811\u7684\u968f\u673a\u5316\u65b9\u6cd5\u6709\u4e24\u79cd\uff1a<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\uff081\uff09\u901a\u8fc7\u9009\u62e9\u7528\u4e8e\u6784\u9020\u6811\u7684\u6570\u636e\u70b9<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u6784\u9020\u968f\u673a\u68ee\u6797\u9700\u8981\u786e\u5b9a\u7528\u4e8e\u6784\u9020\u7684\u6811\u7684\u4e2a\u6570<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u4e3a\u4e86\u786e\u4fdd\u6811\u4e0e\u6811\u4e4b\u95f4\u7684\u533a\u522b\uff0c\u5bf9\u6bcf\u68f5\u6811\u7684\u6570\u636e\u8fdb\u884c\u81ea\u52a9\u91c7\u6837<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u4ece\u6837\u672c\u6570\u636e\u4e2d\u6709\u653e\u56de\u7684\u591a\u6b21\u62bd\u53d6\uff08\u4e00\u4e2a\u6837\u672c\u53ef\u80fd\u88ab\u62bd\u53d6\u591a\u6b21\uff09\uff0c\u62bd\u53d6\u521b\u5efa\u7684\u65b0\u6570\u636e\u96c6\u8981\u548c\u539f\u6570\u636e\u96c6\u5927\u5c0f\u76f8\u7b49\uff08\u6570\u636e\u6570\u91cf\u76f8\u540c\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\uff082\uff09\u901a\u8fc7\u9009\u62e9\u6bcf\u6b21\u5212\u5206\u6d4b\u8bd5\u96c6\u7684\u7279\u5f81<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5728\u6bcf\u4e2a\u8282\u70b9\u5904\uff0c\u7b97\u6cd5\u968f\u673a\u9009\u62e9\u7279\u5f81\u7684\u4e00\u4e2a\u5b50\u96c6\uff0c\u5e76\u5bf9\u5176\u4e2d\u4e00\u4e2a\u7279\u5f81\u5bfb\u627e\u6700\u4f73\u6d4b\u8bd5\uff0c\u800c\u4e0d\u662f\u5bf9\u6bcf\u4e2a\u8282\u70b9\u90fd\u5bfb\u627e\u6700\u4f73\u6d4b\u8bd5\u3002<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u4f7f\u7528\u53c2\u6570max_features, \u5982\u679cmax_features= n_features\uff0c\u5219\u6bcf\u6b21\u8003\u8651\u6240\u6709\u7279\u5f81\uff0c\u5373\u7b2c\u4e8c\u79cd\u968f\u673a\u6027\u6ca1\u7528\u4e0a<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5f53max_features\u8f83\u5927\uff0c\u968f\u673a\u68ee\u6797\u4e2d\u6bcf\u68f5\u6811\u90fd\u4f1a\u5f88\u76f8\u4f3c\uff08\u56e0\u4e3a\u91c7\u7528\u7684\u7279\u5f81\u57fa\u672c\u76f8\u540c\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5982\u679cmax_features\u8f83\u5c0f\uff0c\u6811\u7684\u5dee\u5f02\u8f83\u5927\uff0c\u4e3a\u4e86\u5f88\u597d\u7684\u62df\u5408\u6570\u636e\uff0c\u6bcf\u68f5\u6811\u7684\u6df1\u5ea6\u90fd\u5e94\u8be5\u8f83\u5927\u3002<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">RandomForestClassifier\uff08n_estimators = 5,random_state = 2)#\u4e94\u68f5\u6811\u7684\u968f\u673a\u68ee\u6797<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u968f\u673a\u68ee\u6797\u6bd4\u5355\u72ec\u4e00\u68f5\u6811\u7684\u8fc7\u62df\u5408\u90fd\u8981\u5c0f\uff0c\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6211\u4eec\u4f1a\u7528\u5f88\u591a\u6811\uff08\u901a\u5e38\u51e0\u767e\u4e0a\u5343),\u4ece\u800c\u8fbe\u5230\u51b3\u7b56\u8fb9\u754c\u66f4\u5e73\u6ed1\u7684\u6548\u679c<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u4e00\u822c\uff0c\u968f\u673a\u68ee\u6797\u7ed9\u51fa\u7684\u7279\u5f81\u91cd\u8981\u6027\u6bd4\u5355\u79d1\u51b3\u7b56\u6811\u7ed9\u51fa\u7684\u53ef\u9760\u3002<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u591a\u6838CPU\u53ef\u4ee5\u8bbe\u7f6e\u53c2\u6570n_jobs = -1\u6765\u4f7f\u7528\u8ba1\u7b97\u673a\u7684\u6240\u6709\u5185\u6838\u8ba1\u7b97<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u8bbe\u7f6e\u4e0d\u540c\u7684\u968f\u673a\u72b6\u6001\uff08\u6216\u8005\u4e0d\u8bbe\u7f6erandom_state\u53c2\u6570\uff09\u53ef\u4ee5\u5f7b\u5e95\u6539\u53d8\u6784\u5efa\u7684\u6a21\u578b<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5982\u679c\u5e0c\u671b\u7ed3\u679c\u91cd\u73b0\uff0c\u56fa\u5b9arandom_state<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5bf9\u4e8e\u9ad8\u7ef4\u7a00\u758f\u6570\u636e\uff08\u4f8b\u5982\u6587\u672c\u6570\u636e\uff09\u968f\u673a\u68ee\u6797\u5e38\u5e38\u8868\u73b0\u4e0d\u4f73\uff0c\u4f7f\u7528\u7ebf\u6027\u6a21\u578b\u66f4\u4e3a\u5408\u9002<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u968f\u673a\u68ee\u6797\u9700\u8981\u8c03\u8282\u7684\u91cd\u8981\u53c2\u6570\u6709n_estimators\u548cmax_features\uff0c\u8fd8\u5305\u62ec\u9884\u526a\u679d\u9009\u9879\uff08\u5982max_depth\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">n_estimators\u603b\u662f\u8d8a\u5927\u8d8a\u597d\uff08\u65f6\u95f4\u5185\u5b58\u5141\u8bb8\u7684\u8bdd\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">max_features\u51b3\u5b9a\u6bcf\u68f5\u6811\u7684\u968f\u673a\u6027\u5927\u5c0f\uff0c\u8f83\u5c0f\u53ef\u4ee5\u964d\u4f4e\u8fc7\u62df\u5408\uff0c\u4e00\u822c\u4f7f\u7528\u9ed8\u8ba4\u503c<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5206\u7c7b\u65f6\u9ed8\u8ba4\u503c\u4e3asqrt\uff08n_features)<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5bf9\u4e8e\u56de\u5f52\u9ed8\u8ba4\u503c\u662fn_features<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">22.\u68af\u5ea6\u63d0\u5347\u56de\u5f52\u6811\uff08\u68af\u5ea6\u63d0\u5347\u673a\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u68af\u5ea6\u63d0\u5347\u91c7\u7528\u8fde\u7eed\u7684\u65b9\u5f0f\u6784\u9020\u6811\uff0c\u6bcf\u68f5\u6811\u90fd\u8bd5\u56fe\u7ea0\u6b63\u524d\u4e00\u68f5\u6811\u7684\u9519\u8bef\u3002<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u68af\u5ea6\u63d0\u5347\u6811\u80cc\u540e\u7684\u4e3b\u8981\u601d\u60f3\u662f\u5408\u5e76\u8bb8\u591a\u7b80\u5355\u7684\u6a21\u578b\uff08\u5728\u8fd9\u4e2a\u8bed\u5883\u4e2d\u53eb\u505a\u5f31\u5b66\u4e60\u5668\uff09\uff0c\u6bd4\u5982\u6df1\u5ea6\u8f83\u5c0f\u7684\u6811<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u6bcf\u68f5\u6811\u53ea\u80fd\u5bf9\u90e8\u5206\u6570\u636e\u4f5c\u51fa\u597d\u7684\u9884\u6d4b\uff0c\u6240\u4ee5\u6dfb\u52a0\u66f4\u591a\u7684\u6811\u53ef\u4ee5\u4e0d\u65ad\u8fed\u4ee3\u63d0\u9ad8\u6027\u80fd<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u9664\u4e86\u9884\u526a\u679d\u548c\u968f\u673a\u68ee\u6797\u91cc\u7684\u6811\u7684\u6570\u91cf\u4e4b\u5916\uff0c\u68af\u5ea6\u63d0\u5347\u6811\u7684\u53e6\u4e00\u4e2a\u91cd\u8981\u53c2\u6570\u662f\u5b66\u4e60\u7387\uff08learning_rate)<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u7528\u4e8e\u63a7\u5236\u6bcf\u68f5\u6811\u7ea0\u6b63\u524d\u4e00\u68f5\u6811\u9519\u8bef\u7684\u5f3a\u5ea6\uff0c\u901a\u8fc7\u589e\u5927learning_rate\u6216n_estimators\u90fd\u4f1a\u589e\u52a0\u6a21\u578b\u7684\u590d\u6742\u5ea6<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u964d\u4f4e\u6811\u7684\u6700\u5927\u6df1\u5ea6\u548c\u5b66\u4e60\u7387\u90fd\u80fd\u964d\u4f4e\u8fc7\u62df\u5408<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">GradientBoostingClassifier\uff08random_state=0, max_depth=1, learning_rate=0.01)<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u968f\u673a\u68ee\u6797\u7684n_estimators\u8d8a\u5927\u8d8a\u597d<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u68af\u5ea6\u63d0\u5347\u6811\u7684n_estimators\u63d0\u9ad8\uff0c\u6a21\u578b\u590d\u6742\uff0c\u4f1a\u5bfc\u81f4\u8fc7\u62df\u5408<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u68af\u5ea6\u63d0\u5347\u6811\u7684max_depth\u901a\u5e38\u8bbe\u7f6e\u7684\u5f88\u5c0f\uff0c\u4e00\u822c\u4e0d\u8d85\u8fc75<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u7531\u4e8e\u68af\u5ea6\u63d0\u5347\u548c\u968f\u673a\u68ee\u6797\u4e24\u79cd\u65b9\u6cd5\u5728\u7c7b\u4f3c\u7684\u6570\u636e\u4e0a\u8868\u73b0\u7684\u90fd\u5f88\u597d<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u56e0\u6b64\u4e00\u79cd\u5e38\u7528\u7684\u65b9\u6cd5\u662f\u5148\u5c1d\u8bd5\u968f\u673a\u68ee\u6797\uff0c\u5b83\u7684\u9c81\u68d2\u6027\u5f88\u597d\uff0c\u5982\u679c\u968f\u673a\u68ee\u6797\u6548\u679c\u5f88\u597d\uff0c\u4f46\u662f\u9884\u6d4b\u65f6\u95f4\u592a\u957f\uff0c\u9009\u62e9\u68af\u5ea6\u63d0\u5347<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u68af\u5ea6\u63d0\u5347\u6811\u7684\u9700\u8981\u4ed4\u7ec6\u8c03\u53c2\uff0c\u8bad\u7ec3\u65f6\u95f4\u4e5f\u957f\uff0c\u4e5f\u4e0d\u9002\u5408\u9ad8\u7ef4\u7a00\u758f\u6570\u636e<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">23.\u5bf9\u4e8eSVM\uff0c\u5c06\u6570\u636e\u6620\u5c04\u5230\u66f4\u9ad8\u7ef4\u7a7a\u95f4\u4e2d\u6709\u4e24\u79cd\u5e38\u7528\u65b9\u6cd5\uff1a<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\uff081\uff09\u591a\u9879\u5f0f\u6838\uff1b\u5728\u4e00\u5b9a\u9636\u6570\u5185\u8ba1\u7b97\u539f\u59cb\u7279\u5f81\u6240\u6709\u53ef\u80fd\u7684\u591a\u9879\u5f0f\uff08\u4f8b\u5982features1**2\uff0c features2**5\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\uff082\uff09\u5f84\u5411\u57fa\u51fd\u6570\uff08RBF) \u6838\uff0c\u4e5f\u53eb\u9ad8\u65af\u6838\u3002\u5b83\u8003\u8651\u6240\u6709\u9636\u6570\u7684\u6240\u6709\u53ef\u80fd\u7684\u591a\u9879\u5f0f\uff0c\u4f46\u9636\u6570\u8d8a\u9ad8\uff0c\u7279\u5f81\u7684\u91cd\u8981\u6027\u8d8a\u5c0f\u3002<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">24.SVM\u8c03\u53c2<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">gamma\u53c2\u6570\uff0c\u63a7\u5236\u9ad8\u65af\u6838\u7684\u5bbd\u5ea6\uff0c\u5b83\u51b3\u5b9a\u4e86\u70b9\u4e0e\u70b9\u4e4b\u95f4\u201c\u9760\u8fd1\u201d\u662f\u6307\u591a\u5927\u7684\u8ddd\u79bb\u3002C\u53c2\u6570\u662f\u6b63\u5219\u5316\u53c2\u6570\uff0c\u4e0e\u7ebf\u6027\u6a21\u578b\u7c7b\u4f3c<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5b83\u9650\u5236\u6bcf\u4e2a\u70b9\u7684\u91cd\u8981\u6027<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u4ece\u5c0f\u589e\u5927gamma\uff080.1-10\uff09\uff0c\u5b83\u8ba4\u4e3a\u70b9\u4e0e\u70b9\u4e4b\u95f4\u7684\u8ddd\u79bb\u4e0d\u65ad\u589e\u5927\uff0c\u4ece\u51b3\u7b56\u8fb9\u754c\u5e73\u6ed1\u5f80\u4e0d\u5e73\u6ed1\u8fc7\u6e21\uff0c\u6a21\u578b\u8d8a\u52a0\u590d\u6742<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u8fd9\u4e24\u4e2a\u53c2\u6570\u5f3a\u70c8\u76f8\u5173\uff0c\u53ef\u4ee5\u540c\u65f6\u8c03\u8282<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">C\u4ece\u5c0f\u5230\u5927\uff0c\u51b3\u7b56\u8fb9\u754c\u8d8a\u6765\u8d8a\u4e0d\u5e73\u6ed1<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff1aC=1,gamma=1\/n_features<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">SVM\u6570\u636e\u9700\u8981\u9884\u5904\u7406\uff08\u5e38\u7528\u7684\u662f\u7f29\u653e\u52300~1\u4e4b\u95f4\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5e38\u7528\u7684\u662f\uff08x-xmin\uff09\/\uff08xmax-xmin\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">SVM\u7684\u7f3a\u70b9\uff1a\u9700\u8981\u9884\u5904\u7406\u548c\u5c0f\u5fc3\u8c03\u53c2\uff0cSVM\u6a21\u578b\u5f88\u96be\u68c0\u9a8c\uff0c\u4e5f\u96be\u4ee5\u89e3\u91ca<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">25.\u795e\u7ecf\u7f51\u7edc\u7684\u975e\u7ebf\u6027\u51fd\u6570\u5e38\u7528\u6821\u6b63\u975e\u7ebf\u6027\uff08relu\uff09\u6216\u6b63\u5207\u53cc\u66f2\u7ebf\uff08tanh\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">relu\u622a\u65ad\u5c0f\u4e8e0\u7684\u503c<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">tanh\u5728\u8f93\u5165\u503c\u5c0f\u65f6\u63a5\u8fd1-1\uff0c\u8f83\u5927\u65f6\u63a5\u8fd11<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u6709\u4e86\u8fd9\u4e24\u79cd\u975e\u7ebf\u6027\u51fd\u6570\uff0c\u795e\u7ecf\u7f51\u7edc\u53ef\u4ee5\u5b66\u4e60\u6bd4\u7ebf\u6027\u6a21\u578b\u590d\u6742\u5f97\u591a\u7684\u51fd\u6570<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u591a\u5c42\u611f\u77e5\u673a\uff08MLP )\uff0c\u4e5f\u79f0\u4e3a\u666e\u901a\u524d\u9988\u795e\u7ecf\u7f51\u7edc\uff0c\u9ed8\u8ba4\u65f6\uff0c\u6bcf\u5c42\u4f7f\u7528100\u4e2a\u9690\u8282\u70b9<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u9ed8\u8ba4\u7684\u662frelu<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">MLPClassifier\uff08solver=&#8217;lbfgs&#8217;,random_state=0,hidden_layer_sizes=[10])<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">10\u5c42<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5982\u679c\u662f10\u5c42\u4e14\u6bcf\u5c4210\u4e2a\u9690\u8282\u70b9<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5219hidden_layer_sizes=[10\uff0c10]<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">MLPClassifier\u4e2d\u8c03\u8282L2\u60e9\u7f5a\u7684\u53c2\u6570\u662falpha\uff08\u4e0e\u7ebf\u6027\u56de\u5f52\u6a21\u578b\u76f8\u540c\uff09\uff0c\u9ed8\u8ba4\u503c\u5f88\u5c0f\uff08\u5f31\u6b63\u5219\u5316\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u63a7\u5236\u795e\u7ecf\u7f51\u7edc\u7684\u590d\u6742\u5ea6\u7684\u65b9\u6cd5\u6709\u5f88\u591a\u79cd\uff0c\u9690\u5c42\u7684\u4e2a\u6570\u3001\u6bcf\u4e2a\u9690\u5c42\u4e2d\u7684\u5355\u5143\u4e2a\u6570\u4e0e\u6b63\u5219\u5316\uff08alpha\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u795e\u7ecf\u7f51\u7edc\u8981\u6c42\u8f93\u5165\u7279\u5f81\u7684\u53d8\u5316\u8303\u56f4\u76f8\u4f3c\uff0c\u6700\u7406\u60f3\u7684\u60c5\u51b5\u662f\u5747\u503c\u4e3a0\uff0c\u65b9\u5dee\u4e3a1<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u6211\u4eec\u5fc5\u987b\u5bf9\u6570\u636e\u8fdb\u884c\u7f29\u653e\u8fbe\u5230\u8fd9\u4e00\u8981\u6c42<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">StandardScaler\u53ef\u4ee5\u8fbe\u5230\u6570\u636e\u5904\u7406\u8981\u6c42<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u8fed\u4ee3\u6b21\u6570\u53c2\u6570MLPClassifier\uff08max_iter = 1000,random_state=0)<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u529f\u80fd\u5f3a\u5927\u7684\u795e\u7ecf\u7f51\u7edc\u7ecf\u5e38\u9700\u8981\u5f88\u957f\u7684\u8bad\u7ec3\u65f6\u95f4<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u795e\u7ecf\u7f51\u7edc\u7684\u8c03\u53c2\u5e38\u7528\u65b9\u6cd5\u662f\uff0c\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u5927\u5230\u8db3\u4ee5\u8fc7\u62df\u5408\u7684\u7f51\u7edc\uff0c\u786e\u4fdd\u8fd9\u4e2a\u7f51\u7edc\u53ef\u4ee5\u5bf9\u4efb\u52a1\u8fdb\u884c\u5b66\u4e60<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u7136\u540e\u901a\u8fc7\u7f29\u5c0f\u7f51\u7edc\u6216\u8005\u589e\u5927alpha\u6765\u589e\u5f3a\u6b63\u5219\u5316\uff0c\u4ece\u800c\u63d0\u9ad8\u6cdb\u5316\u6027\u80fd<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5982\u4f55\u5b66\u4e60\u6a21\u578b\u6216\u7528\u6765\u5b66\u4e60\u53c2\u6570\u7684\u7b97\u6cd5\uff0c\u7531solver\u53c2\u6570\u8bbe\u5b9a<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u9ed8\u8ba4\u4e3a&#8217;adam&#8217;,\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u6548\u679c\u5f88\u597d\uff0c\u4f46\u662f\u5bf9\u6570\u636e\u7684\u7f29\u653e\u76f8\u5f53\u654f\u611f\uff08\u9700\u8981\u5c06\u6570\u636e\u7f29\u653e\u4e3a\u5747\u503c\u4e3a0\uff0c\u65b9\u5dee\u4e3a1\uff09<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">&#8216;lbfgs&#8217;\u7684\u9c81\u68d2\u6027\u5f88\u597d\uff0c\u5927\u578b\u6570\u636e\u96c6\u548c\u5927\u578b\u6a21\u578b\u4e0a\u65f6\u95f4\u8f83\u957f<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u66f4\u9ad8\u7ea7\u7684&#8217;sgd&#8217;<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u521d\u5b66\u8005\u5efa\u8bae\u4f7f\u7528\u524d\u4e24\u79cd<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">sklearn\u4e2d\u6709\u4e24\u4e2a\u51fd\u6570\u53ef\u7528\u4e8e\u83b7\u53d6\u5206\u7c7b\u5668\u7684\u4e0d\u786e\u5b9a\u6027\u4f30\u8ba1\uff1adecision_function\u548cpredict_proba<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5927\u591a\u6570\u5206\u7c7b\u5668\u90fd\u81f3\u5c11\u6709\u5176\u4e2d\u4e00\u4e2a\u51fd\u6570\uff0c\u5f88\u591a\u5206\u7c7b\u5668\u8fd9\u4e24\u4e2a\u90fd\u6709<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">predict_proba\u7684\u7ed3\u679c\u662f\uff1a<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u6bcf\u884c\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20\u662f\u7b2c\u4e00\u4e2a\u7c7b\u522b\u7684\u4f30\u8ba1\u6982\u7387\uff0c\u7b2c\u4e8c\u4e2a\u5143\u7d20\u662f\u7b2c\u4e8c\u4e2a\u7c7b\u522b\u7684\u4f30\u8ba1\u6982\u7387<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">predict_proba\u8f93\u51fa\u7684\u662f\u6982\u7387\uff0c\u57280~1\u4e4b\u95f4\uff0c\u4e24\u4e2a\u7c7b\u522b\u7684\u5143\u7d20\u4e4b\u548c\u59cb\u7ec8\u4e3a1<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">decision_function\u6bcf\u4e00\u5217\u5bf9\u5e94\u6bcf\u4e2a\u7c7b\u522b\u7684\u786e\u5b9a\u5ea6\u5206\u6570\uff0c\u5206\u6570\u8d8a\u9ad8\u7c7b\u522b\u7684\u53ef\u80fd\u6027\u8d8a\u5927<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">26.\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684\u6a21\u578b\uff1a<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">KNN<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u9002\u7528\u4e8e\u5c0f\u578b\u6570\u636e\u96c6\uff0c\u5bb9\u6613\u89e3\u91ca<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u7ebf\u6027\u6a21\u578b<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u975e\u5e38\u53ef\u9760\u7684\u9996\u9009\u7b97\u6cd5\uff0c\u9002\u7528\u4e8e\u975e\u5e38\u5927\u7684\u6570\u636e\u96c6\uff0c\u4e5f\u9002\u5408\u9ad8\u7ef4\u6570\u636e<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u6734\u7d20\u8d1d\u53f6\u65af<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u53ea\u9002\u7528\u4e8e\u5206\u7c7b\u95ee\u9898\uff0c\u6bd4\u7ebf\u6027\u6a21\u578b\u901f\u5ea6\u8fd8\u5feb\uff0c\u9002\u7528\u4e8e\u975e\u5e38\u5927\u7684\u6570\u636e\u96c6\u6216\u8005\u9ad8\u7ef4\u6570\u636e<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u7cbe\u5ea6\u901a\u5e38\u8981\u4f4e\u4e8e\u7ebf\u6027\u6a21\u578b<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u51b3\u7b56\u6811<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u901f\u5ea6\u5f88\u5feb\uff0c\u4e0d\u9700\u8981\u6570\u636e\u653e\u7f29\uff0c\u53ef\u4ee5\u53ef\u89c6\u5316\uff0c\u5bb9\u6613\u89e3\u91ca<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u968f\u673a\u68ee\u6797<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u51e0\u4e4e\u603b\u662f\u6bd4\u5355\u68f5\u51b3\u7b56\u6811\u8868\u73b0\u597d\uff0c\u9c81\u68d2\u6027\u597d\uff0c\u4e0d\u9700\u8981\u6570\u636e\u653e\u7f29\uff0c\u4e0d\u9002\u7528\u4e8e\u9ad8\u7ef4\u6570\u636e<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u68af\u5ea6\u63d0\u5347\u51b3\u7b56\u6811<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u7cbe\u5ea6\u901a\u5e38\u6bd4\u968f\u673a\u68ee\u6797\u7565\u9ad8\uff0c\u4f46\u662f\u8bad\u7ec3\u901f\u5ea6\u6bd4\u968f\u673a\u68ee\u6797\u6162\uff0c\u9884\u6d4b\u901f\u5ea6\u6bd4\u968f\u673a\u68ee\u6797\u5feb\uff0c\u9700\u8981\u7684\u5185\u5b58\u5c11\uff0c\u6bd4\u968f\u673a\u68ee\u6797\u9700\u8981\u8c03\u7684\u53c2\u6570\u591a<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">SVM<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5bf9\u4e8e\u7279\u5f81\u542b\u4e49\u76f8\u4f3c\u7684\u4e2d\u7b49\u5927\u5c0f\u7684\u6570\u636e\u96c6\u5f88\u5f3a\u5927\uff0c\u9700\u8981\u6570\u636e\u7f29\u653e\uff0c\u5bf9\u53c2\u6570\u654f\u611f<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u795e\u7ecf\u7f51\u7edc<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u53ef\u4ee5\u6784\u5efa\u975e\u5e38\u590d\u6742\u7684\u6a21\u578b\uff0c\u7279\u522b\u662f\u5927\u578b\u6570\u636e\u96c6\uff0c\u5bf9\u6570\u636e\u7f29\u653e\u654f\u611f\uff0c\u5bf9\u53c2\u6570\u9009\u53d6\u654f\u611f\uff0c\u5927\u578b\u7f51\u7edc\u9700\u8981\u5f88\u957f\u7684\u8bad\u7ec3\u65f6\u95f4<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u9762\u5bf9\u6570\u636e\u96c6\uff0c\u5148\u4ece\u7b80\u5355\u7684\u6a21\u578b\u5f00\u59cb\uff0c\u6bd4\u5982\u7ebf\u6027\u56de\u5f52\u3001\u6734\u7d20\u8d1d\u53f6\u65af\u3001KNN\uff0c\u770b\u770b\u80fd\u5f97\u5230\u7684\u7ed3\u679c<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5bf9\u6570\u636e\u7406\u89e3\u52a0\u6df1\u540e\uff0c\u53ef\u4ee5\u8003\u8651\u66f4\u590d\u6742\u7684\u6a21\u578b<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u5982\u968f\u673a\u68ee\u6797\u3001\u68af\u5ea6\u63d0\u5347\u51b3\u7b56\u6811\u3001SVM\u3001\u795e\u7ecf\u7f51\u7edc<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u53c2\u8003\u6587\u732e\uff1aIntroduction to Machine Learning with Pyth<\/span><span style=\"font-size: 16px;\">on<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\"><span style=\"font-size: 16px;\">\u53c2\u8003\u6587\u732e\uff1aIntroduction to Machine Learning with Python<\/span><\/p>\n<p style=\"box-sizing: border-box; margin-top: 12px; margin-bottom: 12px;\">\n","protected":false},"excerpt":{"rendered":"<p style=\"box-sizing:border-box;margin-bottom:12px;\">\n\t<span style=\"font-size:14px;\">\u539f\u6587\uff1a<a href=\"https:\/\/ask.hellobi.com\/blog\/wangdawei\/12190\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/ask.hellobi.com\/blog\/wangdawei\/12190<\/a><\/span>\n<\/p>\n<p style=\"box-sizing:border-box;margin-bottom:12px;\">\n\t<span style=\"font-size:14px;\">1. \u5982\u679c\u53ea\u5212\u5206\u6d4b\u8bd5\u96c6\u548c\u8bad\u7ec3\u96c6&nbsp;&nbsp;&nbsp; \u7ecf\u9a8c\u662f75%\u4f5c\u4e3a\u8bad\u7ec3\u96c6&nbsp;<\/span>\n<\/p>\n<p style=\"box-sizing:border-box;margin-top:12px;margin-bottom:12px;\">\n\t<span style=\"font-size:14px;\">sklearn\u4e2d\u7684train_test_split()\u9ed8\u8ba4\u8fd9\u6837\u5212\u5206<\/span>\n<\/p>\n<p style=\"box-sizing:border-box;margin-top:12px;margin-bottom:12px;\">\n\t<span style=\"font-size:14px;\">from sklearn.model_selection import train_test_split<\/span>\n<\/p>\n<p style=\"box-sizing:border-box;margin-top:12px;margin-bottom:12px;\">\n\t<span style=\"font-size:14px;\">X_train, X_test, &#8230;<\/span><\/p>\n","protected":false},"author":1,"featured_media":563,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[337],"tags":[],"class_list":["post-255","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[\u8f6c] Python\u673a\u5668\u5b66\u4e60\uff08sklearn\uff09\u2014\u2014\u5206\u7c7b\u6a21\u578b\u8bc4\u4f30\u4e0e\u8c03\u53c2\u603b\u7ed3 - 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=255\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[\u8f6c] Python\u673a\u5668\u5b66\u4e60\uff08sklearn\uff09\u2014\u2014\u5206\u7c7b\u6a21\u578b\u8bc4\u4f30\u4e0e\u8c03\u53c2\u603b\u7ed3 - Wayne&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"\u539f\u6587\uff1ahttps:\/\/ask.hellobi.com\/blog\/wangdawei\/12190    1. \u5982\u679c\u53ea\u5212\u5206\u6d4b\u8bd5\u96c6\u548c\u8bad\u7ec3\u96c6&nbsp;&nbsp;&nbsp; \u7ecf\u9a8c\u662f75%\u4f5c\u4e3a\u8bad\u7ec3\u96c6&nbsp;    sklearn\u4e2d\u7684train_test_split()\u9ed8\u8ba4\u8fd9\u6837\u5212\u5206    from sklearn.model_selection import train_test_split    X_train, X_test, ...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/weizn.net\/?p=255\" \/>\n<meta property=\"og:site_name\" content=\"Wayne&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-17T16:10:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-30T18:01:46+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/weizn.net\/wp-content\/uploads\/2018\/11\/scikit-learn.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1050\" \/>\n\t<meta property=\"og:image:height\" content=\"520\" \/>\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=\"1 \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=255#primaryimage\",\"inLanguage\":\"zh-Hans\",\"url\":\"http:\/\/weizn.net\/wp-content\/uploads\/2018\/11\/scikit-learn.jpg\",\"contentUrl\":\"http:\/\/weizn.net\/wp-content\/uploads\/2018\/11\/scikit-learn.jpg\",\"width\":1050,\"height\":520},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/weizn.net\/?p=255#webpage\",\"url\":\"http:\/\/weizn.net\/?p=255\",\"name\":\"[\\u8f6c] Python\\u673a\\u5668\\u5b66\\u4e60\\uff08sklearn\\uff09\\u2014\\u2014\\u5206\\u7c7b\\u6a21\\u578b\\u8bc4\\u4f30\\u4e0e\\u8c03\\u53c2\\u603b\\u7ed3 - Wayne&#039;s Blog\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/weizn.net\/?p=255#primaryimage\"},\"datePublished\":\"2018-11-17T16:10:10+00:00\",\"dateModified\":\"2020-09-30T18:01:46+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/weizn.net\/?p=255#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/weizn.net\/?p=255\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/weizn.net\/?p=255#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\\u9996\\u9875\",\"item\":\"http:\/\/weizn.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[\\u8f6c] Python\\u673a\\u5668\\u5b66\\u4e60\\uff08sklearn\\uff09\\u2014\\u2014\\u5206\\u7c7b\\u6a21\\u578b\\u8bc4\\u4f30\\u4e0e\\u8c03\\u53c2\\u603b\\u7ed3\"}]},{\"@type\":\"Article\",\"@id\":\"http:\/\/weizn.net\/?p=255#article\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/?p=255#webpage\"},\"author\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"headline\":\"[\\u8f6c] Python\\u673a\\u5668\\u5b66\\u4e60\\uff08sklearn\\uff09\\u2014\\u2014\\u5206\\u7c7b\\u6a21\\u578b\\u8bc4\\u4f30\\u4e0e\\u8c03\\u53c2\\u603b\\u7ed3\",\"datePublished\":\"2018-11-17T16:10:10+00:00\",\"dateModified\":\"2020-09-30T18:01:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/weizn.net\/?p=255#webpage\"},\"wordCount\":282,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"image\":{\"@id\":\"http:\/\/weizn.net\/?p=255#primaryimage\"},\"thumbnailUrl\":\"http:\/\/weizn.net\/wp-content\/uploads\/2018\/11\/scikit-learn.jpg\",\"articleSection\":[\"\\u6570\\u636e\\u5206\\u6790\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/weizn.net\/?p=255#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] Python\u673a\u5668\u5b66\u4e60\uff08sklearn\uff09\u2014\u2014\u5206\u7c7b\u6a21\u578b\u8bc4\u4f30\u4e0e\u8c03\u53c2\u603b\u7ed3 - 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=255","og_locale":"zh_CN","og_type":"article","og_title":"[\u8f6c] Python\u673a\u5668\u5b66\u4e60\uff08sklearn\uff09\u2014\u2014\u5206\u7c7b\u6a21\u578b\u8bc4\u4f30\u4e0e\u8c03\u53c2\u603b\u7ed3 - Wayne&#039;s Blog","og_description":"\u539f\u6587\uff1ahttps:\/\/ask.hellobi.com\/blog\/wangdawei\/12190    1. \u5982\u679c\u53ea\u5212\u5206\u6d4b\u8bd5\u96c6\u548c\u8bad\u7ec3\u96c6&nbsp;&nbsp;&nbsp; \u7ecf\u9a8c\u662f75%\u4f5c\u4e3a\u8bad\u7ec3\u96c6&nbsp;    sklearn\u4e2d\u7684train_test_split()\u9ed8\u8ba4\u8fd9\u6837\u5212\u5206    from sklearn.model_selection import train_test_split    X_train, X_test, ...","og_url":"http:\/\/weizn.net\/?p=255","og_site_name":"Wayne&#039;s Blog","article_published_time":"2018-11-17T16:10:10+00:00","article_modified_time":"2020-09-30T18:01:46+00:00","og_image":[{"width":1050,"height":520,"url":"http:\/\/weizn.net\/wp-content\/uploads\/2018\/11\/scikit-learn.jpg","path":"\/app\/wp-content\/uploads\/2018\/11\/scikit-learn.jpg","size":"full","id":563,"alt":"","pixels":546000,"type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"zinan","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \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=255#primaryimage","inLanguage":"zh-Hans","url":"http:\/\/weizn.net\/wp-content\/uploads\/2018\/11\/scikit-learn.jpg","contentUrl":"http:\/\/weizn.net\/wp-content\/uploads\/2018\/11\/scikit-learn.jpg","width":1050,"height":520},{"@type":"WebPage","@id":"http:\/\/weizn.net\/?p=255#webpage","url":"http:\/\/weizn.net\/?p=255","name":"[\u8f6c] Python\u673a\u5668\u5b66\u4e60\uff08sklearn\uff09\u2014\u2014\u5206\u7c7b\u6a21\u578b\u8bc4\u4f30\u4e0e\u8c03\u53c2\u603b\u7ed3 - Wayne&#039;s Blog","isPartOf":{"@id":"http:\/\/weizn.net\/#website"},"primaryImageOfPage":{"@id":"http:\/\/weizn.net\/?p=255#primaryimage"},"datePublished":"2018-11-17T16:10:10+00:00","dateModified":"2020-09-30T18:01:46+00:00","breadcrumb":{"@id":"http:\/\/weizn.net\/?p=255#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/weizn.net\/?p=255"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/weizn.net\/?p=255#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/weizn.net\/"},{"@type":"ListItem","position":2,"name":"[\u8f6c] Python\u673a\u5668\u5b66\u4e60\uff08sklearn\uff09\u2014\u2014\u5206\u7c7b\u6a21\u578b\u8bc4\u4f30\u4e0e\u8c03\u53c2\u603b\u7ed3"}]},{"@type":"Article","@id":"http:\/\/weizn.net\/?p=255#article","isPartOf":{"@id":"http:\/\/weizn.net\/?p=255#webpage"},"author":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"headline":"[\u8f6c] Python\u673a\u5668\u5b66\u4e60\uff08sklearn\uff09\u2014\u2014\u5206\u7c7b\u6a21\u578b\u8bc4\u4f30\u4e0e\u8c03\u53c2\u603b\u7ed3","datePublished":"2018-11-17T16:10:10+00:00","dateModified":"2020-09-30T18:01:46+00:00","mainEntityOfPage":{"@id":"http:\/\/weizn.net\/?p=255#webpage"},"wordCount":282,"commentCount":0,"publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"image":{"@id":"http:\/\/weizn.net\/?p=255#primaryimage"},"thumbnailUrl":"http:\/\/weizn.net\/wp-content\/uploads\/2018\/11\/scikit-learn.jpg","articleSection":["\u6570\u636e\u5206\u6790"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/weizn.net\/?p=255#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\/255","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=255"}],"version-history":[{"count":1,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/255\/revisions"}],"predecessor-version":[{"id":564,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/255\/revisions\/564"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/media\/563"}],"wp:attachment":[{"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=255"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}