{"id":960743,"date":"2024-12-27T03:52:28","date_gmt":"2024-12-26T19:52:28","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/960743.html"},"modified":"2024-12-27T03:52:30","modified_gmt":"2024-12-26T19:52:30","slug":"python%e5%bc%82%e5%b8%b8%e5%80%bc%e5%a6%82%e4%bd%95%e5%8e%bb%e9%99%a4","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/960743.html","title":{"rendered":"python\u5f02\u5e38\u503c\u5982\u4f55\u53bb\u9664"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25103148\/4fc55941-9c17-408b-8295-2f3db821c046.webp\" alt=\"python\u5f02\u5e38\u503c\u5982\u4f55\u53bb\u9664\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\u53bb\u9664\u5f02\u5e38\u503c\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u7edf\u8ba1\u65b9\u6cd5\u8bc6\u522b\u5f02\u5e38\u503c\u3001\u5229\u7528Z-score\u3001IQR\u65b9\u6cd5\u68c0\u6d4b\u5f02\u5e38\u503c\u3001\u901a\u8fc7\u6570\u636e\u53ef\u89c6\u5316\u5de5\u5177\u8bc6\u522b\u5f02\u5e38\u503c\u3001\u5e94\u7528<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u7b97\u6cd5\u68c0\u6d4b\u5f02\u5e38\u503c\u3002<\/strong>\u5176\u4e2d\uff0c\u4f7f\u7528\u7edf\u8ba1\u65b9\u6cd5\u8bc6\u522b\u5f02\u5e38\u503c\u662f\u5e38\u7528\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8ba1\u7b97\u6570\u636e\u96c6\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u7136\u540e\u5c06\u6570\u636e\u70b9\u4e0e\u5e73\u5747\u503c\u7684\u504f\u5dee\u8d85\u8fc7\u4e00\u5b9a\u500d\u6570\u7684\u6807\u51c6\u5dee\u7684\u70b9\u8bc6\u522b\u4e3a\u5f02\u5e38\u503c\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e9b\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528\u7edf\u8ba1\u65b9\u6cd5\u8bc6\u522b\u5f02\u5e38\u503c<\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u7edf\u8ba1\u65b9\u6cd5\u53bb\u9664\u5f02\u5e38\u503c\u662f\u4e00\u79cd\u7b80\u5355\u4e14\u6709\u6548\u7684\u65b9\u6cd5\u3002\u901a\u5e38\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8ba1\u7b97\u6570\u636e\u96c6\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u7136\u540e\u8bc6\u522b\u51fa\u504f\u79bb\u5e73\u5747\u503c\u8d85\u8fc7\u4e00\u5b9a\u500d\u6570\u6807\u51c6\u5dee\u7684\u70b9\u4f5c\u4e3a\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee<\/strong><\/li>\n<\/ol>\n<p><p>\u5728\u6570\u636e\u96c6\u4e2d\uff0c\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\u662f\u4e24\u4e2a\u91cd\u8981\u7684\u7edf\u8ba1\u91cf\u3002\u5e73\u5747\u503c\u8868\u793a\u6570\u636e\u7684\u4e2d\u5fc3\u4f4d\u7f6e\uff0c\u800c\u6807\u51c6\u5dee\u8868\u793a\u6570\u636e\u7684\u79bb\u6563\u7a0b\u5ea6\u3002\u901a\u8fc7\u8ba1\u7b97\u6bcf\u4e2a\u6570\u636e\u70b9\u4e0e\u5e73\u5747\u503c\u7684\u504f\u5dee\uff0c\u5e76\u4e0e\u6807\u51c6\u5dee\u8fdb\u884c\u6bd4\u8f83\uff0c\u53ef\u4ee5\u6709\u6548\u8bc6\u522b\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>def remove_outliers(data, threshold=3):<\/p>\n<p>    mean = np.mean(data)<\/p>\n<p>    std = np.std(data)<\/p>\n<p>    filtered_data = [x for x in data if abs(x - mean) &lt;= threshold * std]<\/p>\n<p>    return filtered_data<\/p>\n<p>data = [10, 12, 12, 13, 12, 20, 100, 12, 13, 12]<\/p>\n<p>filtered_data = remove_outliers(data)<\/p>\n<p>print(filtered_data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86\u4e00\u4e2a\u51fd\u6570<code>remove_outliers<\/code>\uff0c\u5b83\u63a5\u53d7\u4e00\u4e2a\u6570\u636e\u5217\u8868\u548c\u4e00\u4e2a\u9608\u503c\u53c2\u6570<code>threshold<\/code>\u3002\u901a\u8fc7\u8ba1\u7b97\u6570\u636e\u7684\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee\uff0c\u6211\u4eec\u53ef\u4ee5\u8fc7\u6ee4\u6389\u90a3\u4e9b\u504f\u79bb\u5e73\u5747\u503c\u8d85\u8fc7\u9608\u503c\u500d\u6807\u51c6\u5dee\u7684\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li><strong>Z-score\u65b9\u6cd5<\/strong><\/li>\n<\/ol>\n<p><p>Z-score\u662f\u8861\u91cf\u6570\u636e\u70b9\u504f\u79bb\u5747\u503c\u7a0b\u5ea6\u7684\u6807\u51c6\u5316\u6307\u6807\u3002\u901a\u8fc7\u8ba1\u7b97\u6570\u636e\u70b9\u7684Z-score\uff0c\u6211\u4eec\u53ef\u4ee5\u8bc6\u522b\u51fa\u90a3\u4e9bZ-score\u503c\u8f83\u5927\u7684\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from scipy.stats import zscore<\/p>\n<p>data = [10, 12, 12, 13, 12, 20, 100, 12, 13, 12]<\/p>\n<p>z_scores = zscore(data)<\/p>\n<p>filtered_data = [x for i, x in enumerate(data) if abs(z_scores[i]) &lt; 3]<\/p>\n<p>print(filtered_data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>scipy.stats<\/code>\u6a21\u5757\u4e2d\u7684<code>zscore<\/code>\u51fd\u6570\u8ba1\u7b97\u6570\u636e\u7684Z-score\uff0c\u7136\u540e\u8fc7\u6ee4\u6389Z-score\u7edd\u5bf9\u503c\u5927\u4e8e3\u7684\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u5229\u7528IQR\u65b9\u6cd5\u68c0\u6d4b\u5f02\u5e38\u503c<\/p>\n<\/p>\n<p><p>IQR\uff08Interquartile Range\uff09\u65b9\u6cd5\u662f\u57fa\u4e8e\u5206\u4f4d\u6570\u7684\u5f02\u5e38\u503c\u68c0\u6d4b\u65b9\u6cd5\uff0c\u901a\u8fc7\u8ba1\u7b97\u6570\u636e\u96c6\u7684\u56db\u5206\u4f4d\u6570\u95f4\u8ddd\uff0c\u53ef\u4ee5\u6709\u6548\u8bc6\u522b\u51fa\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u8ba1\u7b97IQR<\/strong><\/li>\n<\/ol>\n<p><p>IQR\u662f\u6570\u636e\u96c6\u4e2d\u7b2c75\u767e\u5206\u4f4d\u6570\uff08Q3\uff09\u4e0e\u7b2c25\u767e\u5206\u4f4d\u6570\uff08Q1\uff09\u4e4b\u95f4\u7684\u8ddd\u79bb\u3002\u901a\u5e38\uff0c\u6211\u4eec\u5c06\u4f4e\u4e8eQ1 &#8211; 1.5 * IQR\u6216\u9ad8\u4e8eQ3 + 1.5 * IQR\u7684\u6570\u636e\u70b9\u8bc6\u522b\u4e3a\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def remove_outliers_iqr(data):<\/p>\n<p>    q1 = np.percentile(data, 25)<\/p>\n<p>    q3 = np.percentile(data, 75)<\/p>\n<p>    iqr = q3 - q1<\/p>\n<p>    lower_bound = q1 - 1.5 * iqr<\/p>\n<p>    upper_bound = q3 + 1.5 * iqr<\/p>\n<p>    filtered_data = [x for x in data if lower_bound &lt;= x &lt;= upper_bound]<\/p>\n<p>    return filtered_data<\/p>\n<p>data = [10, 12, 12, 13, 12, 20, 100, 12, 13, 12]<\/p>\n<p>filtered_data = remove_outliers_iqr(data)<\/p>\n<p>print(filtered_data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u5e94\u7528IQR\u65b9\u6cd5<\/strong><\/li>\n<\/ol>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86\u4e00\u4e2a\u51fd\u6570<code>remove_outliers_iqr<\/code>\uff0c\u901a\u8fc7\u8ba1\u7b97\u6570\u636e\u7684Q1\u3001Q3\u548cIQR\uff0c\u7136\u540e\u8fc7\u6ee4\u6389\u4f4e\u4e8e\u4e0b\u9650\u548c\u9ad8\u4e8e\u4e0a\u9650\u7684\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u901a\u8fc7\u6570\u636e\u53ef\u89c6\u5316\u5de5\u5177\u8bc6\u522b\u5f02\u5e38\u503c<\/p>\n<\/p>\n<p><p>\u6570\u636e\u53ef\u89c6\u5316\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u76f4\u89c2\u5730\u8bc6\u522b\u6570\u636e\u4e2d\u7684\u5f02\u5e38\u503c\u3002\u5e38\u7528\u7684\u53ef\u89c6\u5316\u5de5\u5177\u5305\u62ec\u7bb1\u7ebf\u56fe\uff08box plot\uff09\u548c\u6563\u70b9\u56fe\uff08scatter plot\uff09\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u7bb1\u7ebf\u56fe<\/strong><\/li>\n<\/ol>\n<p><p>\u7bb1\u7ebf\u56fe\u662f\u4e00\u79cd\u901a\u8fc7\u53ef\u89c6\u5316\u6570\u636e\u7684\u5206\u5e03\u60c5\u51b5\uff0c\u5e2e\u52a9\u8bc6\u522b\u5f02\u5e38\u503c\u7684\u5de5\u5177\u3002\u5728\u7bb1\u7ebf\u56fe\u4e2d\uff0c\u6570\u636e\u7684\u4e0a\u4e0b\u56db\u5206\u4f4d\u6570\u4e4b\u95f4\u7684\u533a\u57df\u7528\u7bb1\u5b50\u8868\u793a\uff0c\u7bb1\u5b50\u5916\u7684\u6570\u636e\u70b9\u901a\u5e38\u88ab\u89c6\u4e3a\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>data = [10, 12, 12, 13, 12, 20, 100, 12, 13, 12]<\/p>\n<p>plt.boxplot(data)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u6563\u70b9\u56fe<\/strong><\/li>\n<\/ol>\n<p><p>\u6563\u70b9\u56fe\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u8bc6\u522b\u6570\u636e\u4e2d\u7684\u79bb\u7fa4\u70b9\u3002\u901a\u8fc7\u89c2\u5bdf\u6570\u636e\u70b9\u7684\u5206\u5e03\uff0c\u6211\u4eec\u53ef\u4ee5\u8bc6\u522b\u51fa\u90a3\u4e9b\u660e\u663e\u504f\u79bb\u5176\u4ed6\u6570\u636e\u70b9\u7684\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">plt.scatter(range(len(data)), data)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u56db\u3001\u5e94\u7528\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u68c0\u6d4b\u5f02\u5e38\u503c<\/p>\n<\/p>\n<p><p>\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u53ef\u4ee5\u7528\u6765\u8bc6\u522b\u6570\u636e\u96c6\u4e2d\u7684\u5f02\u5e38\u503c\uff0c\u7279\u522b\u662f\u5728\u5904\u7406\u9ad8\u7ef4\u6570\u636e\u65f6\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u5b64\u7acb\u68ee\u6797\uff08Isolation Forest\uff09<\/strong><\/li>\n<\/ol>\n<p><p>\u5b64\u7acb\u68ee\u6797\u662f\u4e00\u79cd\u57fa\u4e8e\u51b3\u7b56\u6811\u7684\u5f02\u5e38\u503c\u68c0\u6d4b\u7b97\u6cd5\uff0c\u901a\u8fc7\u6784\u5efa\u968f\u673a\u6811\u6765\u5206\u79bb\u6570\u636e\u70b9\uff0c\u8bc6\u522b\u51fa\u90a3\u4e9b\u5bb9\u6613\u88ab\u9694\u79bb\u7684\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.ensemble import IsolationForest<\/p>\n<p>data = np.array(data).reshape(-1, 1)<\/p>\n<p>clf = IsolationForest(contamination=0.1)<\/p>\n<p>predictions = clf.fit_predict(data)<\/p>\n<p>filtered_data = data[predictions == 1].flatten()<\/p>\n<p>print(filtered_data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u5c40\u90e8\u5f02\u5e38\u56e0\u5b50\uff08Local Outlier Factor\uff09<\/strong><\/li>\n<\/ol>\n<p><p>\u5c40\u90e8\u5f02\u5e38\u56e0\u5b50\u662f\u4e00\u79cd\u57fa\u4e8e\u5bc6\u5ea6\u7684\u5f02\u5e38\u503c\u68c0\u6d4b\u7b97\u6cd5\uff0c\u901a\u8fc7\u6bd4\u8f83\u6570\u636e\u70b9\u7684\u5bc6\u5ea6\uff0c\u8bc6\u522b\u51fa\u90a3\u4e9b\u5bc6\u5ea6\u663e\u8457\u4f4e\u4e8e\u5468\u56f4\u70b9\u7684\u5f02\u5e38\u503c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.neighbors import LocalOutlierFactor<\/p>\n<p>clf = LocalOutlierFactor(n_neighbors=2)<\/p>\n<p>predictions = clf.fit_predict(data)<\/p>\n<p>filtered_data = data[predictions == 1].flatten()<\/p>\n<p>print(filtered_data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e94\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u53bb\u9664\u5f02\u5e38\u503c\u662f\u6570\u636e\u9884\u5904\u7406\u4e2d\u91cd\u8981\u7684\u4e00\u6b65\uff0c\u5b83\u80fd\u591f\u63d0\u5347\u6570\u636e\u5206\u6790\u7684\u51c6\u786e\u6027\u548c\u6a21\u578b\u7684\u6027\u80fd\u3002\u5728Python\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u6765\u8bc6\u522b\u548c\u53bb\u9664\u5f02\u5e38\u503c\uff0c\u5305\u62ec\u7edf\u8ba1\u65b9\u6cd5\u3001IQR\u65b9\u6cd5\u3001\u6570\u636e\u53ef\u89c6\u5316\u5de5\u5177\u4ee5\u53ca\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u3002\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u53d6\u51b3\u4e8e\u6570\u636e\u7684\u7279\u6027\u548c\u5177\u4f53\u7684\u5e94\u7528\u573a\u666f\u3002\u65e0\u8bba\u91c7\u7528\u54ea\u79cd\u65b9\u6cd5\uff0c\u53bb\u9664\u5f02\u5e38\u503c\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u63d0\u9ad8\u6570\u636e\u7684\u8d28\u91cf\u548c\u53ef\u9760\u6027\uff0c\u4ece\u800c\u4e3a\u540e\u7eed\u7684\u5206\u6790\u548c\u5efa\u6a21\u63d0\u4f9b\u66f4\u597d\u7684\u57fa\u7840\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u8bc6\u522b\u6570\u636e\u4e2d\u7684\u5f02\u5e38\u503c\uff1f<\/strong><br \/>\u8bc6\u522b\u5f02\u5e38\u503c\u901a\u5e38\u53ef\u4ee5\u901a\u8fc7\u7edf\u8ba1\u65b9\u6cd5\u8fdb\u884c\uff0c\u6bd4\u5982\u4f7f\u7528\u6807\u51c6\u5dee\u3001\u56db\u5206\u4f4d\u6570\u6216Z-score\u7b49\u3002\u6807\u51c6\u5dee\u65b9\u6cd5\u4e2d\uff0c\u5982\u679c\u4e00\u4e2a\u6570\u636e\u70b9\u7684\u503c\u8d85\u8fc7\u5747\u503c\u00b13\u4e2a\u6807\u51c6\u5dee\uff0c\u5219\u53ef\u80fd\u88ab\u8ba4\u4e3a\u662f\u5f02\u5e38\u503c\u3002\u56db\u5206\u4f4d\u6570\u65b9\u6cd5\u5219\u6839\u636e\u6570\u636e\u7684IQR\uff08\u56db\u5206\u4f4d\u8ddd\uff09\u6765\u786e\u5b9a\uff0c\u901a\u5e38\u8bbe\u5b9a\u4e3a\u4f4e\u4e8eQ1-1.5<em>IQR\u6216\u9ad8\u4e8eQ3+1.5<\/em>IQR\u7684\u503c\u4e3a\u5f02\u5e38\u503c\u3002<\/p>\n<p><strong>\u53bb\u9664\u5f02\u5e38\u503c\u540e\u4f1a\u5bf9\u6570\u636e\u5206\u6790\u7ed3\u679c\u4ea7\u751f\u4ec0\u4e48\u5f71\u54cd\uff1f<\/strong><br \/>\u53bb\u9664\u5f02\u5e38\u503c\u53ef\u4ee5\u63d0\u9ad8\u6570\u636e\u7684\u6574\u4f53\u8d28\u91cf\uff0c\u51cf\u5c11\u5bf9\u6a21\u578b\u7684\u5e72\u6270\uff0c\u4ece\u800c\u4f7f\u9884\u6d4b\u7ed3\u679c\u66f4\u52a0\u51c6\u786e\u3002\u7136\u800c\uff0c\u8fd9\u4e5f\u53ef\u80fd\u5bfc\u81f4\u4fe1\u606f\u7684\u4e22\u5931\uff0c\u5c24\u5176\u662f\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u5f02\u5e38\u503c\u53ef\u80fd\u643a\u5e26\u91cd\u8981\u7684\u4e1a\u52a1\u4fe1\u606f\u3002\u56e0\u6b64\uff0c\u5728\u53bb\u9664\u5f02\u5e38\u503c\u4e4b\u524d\uff0c\u8bc4\u4f30\u8fd9\u4e9b\u503c\u662f\u5426\u771f\u7684\u4e0d\u7b26\u5408\u6570\u636e\u5206\u5e03\u6216\u662f\u5426\u6709\u5176\u5b58\u5728\u7684\u5408\u7406\u6027\u975e\u5e38\u91cd\u8981\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u53bb\u9664\u5f02\u5e38\u503c\u7684\u5177\u4f53\u65b9\u6cd5\u6709\u54ea\u4e9b\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u5e38\u7528\u7684\u5e93\u5982Pandas\u548cNumPy\u53ef\u4ee5\u6709\u6548\u5904\u7406\u5f02\u5e38\u503c\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528Pandas\u7684<code>DataFrame<\/code>\u5bf9\u8c61\u7ed3\u5408<code>drop()<\/code>\u65b9\u6cd5\u53bb\u9664\u5f02\u5e38\u503c\uff0c\u4e5f\u53ef\u4ee5\u5229\u7528<code>loc<\/code>\u65b9\u6cd5\u7b5b\u9009\u51fa\u6b63\u5e38\u8303\u56f4\u5185\u7684\u6570\u636e\u3002\u4f7f\u7528NumPy\u7684<code>where<\/code>\u51fd\u6570\u8fdb\u884c\u6761\u4ef6\u7b5b\u9009\u4e5f\u662f\u4e00\u79cd\u5e38\u89c1\u65b9\u6cd5\u3002\u6b64\u5916\uff0c\u5229\u7528\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\uff08\u5982Isolation Forest\u6216LOF\uff09\u4e5f\u53ef\u4ee5\u81ea\u52a8\u8bc6\u522b\u548c\u53bb\u9664\u5f02\u5e38\u503c\u3002<\/p>\n<p><strong>\u53bb\u9664\u5f02\u5e38\u503c\u540e\uff0c\u5982\u4f55\u9a8c\u8bc1\u6570\u636e\u7684\u53ef\u9760\u6027\uff1f<\/strong><br \/>\u5728\u53bb\u9664\u5f02\u5e38\u503c\u4e4b\u540e\uff0c\u9a8c\u8bc1\u6570\u636e\u7684\u53ef\u9760\u6027\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u8fdb\u884c\u3002\u53ef\u4ee5\u4f7f\u7528\u53ef\u89c6\u5316\u5de5\u5177\u5982\u7bb1\u7ebf\u56fe\u3001\u6563\u70b9\u56fe\u7b49\uff0c\u89c2\u5bdf\u6570\u636e\u5206\u5e03\u7684\u53d8\u5316\u3002\u540c\u65f6\uff0c\u8fdb\u884c\u63cf\u8ff0\u6027\u7edf\u8ba1\u5206\u6790\uff0c\u67e5\u770b\u5747\u503c\u3001\u65b9\u5dee\u7b49\u6307\u6807\u7684\u53d8\u5316\u3002\u6b64\u5916\uff0c\u4f7f\u7528\u4ea4\u53c9\u9a8c\u8bc1\u7b49\u65b9\u6cd5\uff0c\u8bc4\u4f30\u6a21\u578b\u5728\u65b0\u6570\u636e\u96c6\u4e0a\u7684\u8868\u73b0\uff0c\u786e\u4fdd\u6570\u636e\u5904\u7406\u540e\u6a21\u578b\u7684\u6cdb\u5316\u80fd\u529b\u6ca1\u6709\u53d7\u5230\u5f71\u54cd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u53bb\u9664\u5f02\u5e38\u503c\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u7edf\u8ba1\u65b9\u6cd5\u8bc6\u522b\u5f02\u5e38\u503c\u3001\u5229\u7528Z-score\u3001IQR\u65b9\u6cd5\u68c0\u6d4b\u5f02\u5e38\u503c\u3001\u901a\u8fc7\u6570 [&hellip;]","protected":false},"author":3,"featured_media":960748,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/960743"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=960743"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/960743\/revisions"}],"predecessor-version":[{"id":960750,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/960743\/revisions\/960750"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/960748"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=960743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=960743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=960743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}