{"id":9094,"date":"2024-05-13T22:01:01","date_gmt":"2024-05-13T14:01:01","guid":{"rendered":""},"modified":"2024-05-13T22:01:01","modified_gmt":"2024-05-13T14:01:01","slug":"\u673a\u5668\u5b66\u4e60(\u4e03)\uff1a Bias\u3001Error\u548cVariance\u7684\u533a\u522b\u4e0e\u8054\u7cfb","status":"publish","type":"post","link":"https:\/\/mushiming.com\/9094.html","title":{"rendered":"\u673a\u5668\u5b66\u4e60(\u4e03)\uff1a Bias\u3001Error\u548cVariance\u7684\u533a\u522b\u4e0e\u8054\u7cfb"},"content":{"rendered":"

\n <\/path> \n<\/svg> <\/p>\n

\u5168\u6587\u51719000\u4f59\u5b57\uff0c\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\u7ea618~30\u5206\u949f | \u6ee1\u6ee1\u5e72\u8d27\uff0c\u5efa\u8bae\u6536\u85cf\uff01<\/strong><\/p>\n

\"\u673a\u5668\u5b66\u4e60(\u4e03)\uff1a<\/p>\n

\u4e00\u3001 \u5f15\u8a00<\/h3>\n

\u5728\u673a\u5668\u5b66\u4e60\u9886\u57df\uff0c\u8bef\u5dee\uff08Error\uff09\u3001\u504f\u5dee\uff08Bias\uff09\u548c\u65b9\u5dee\uff08Variance\uff09\u662f\u6211\u4eec\u5e38\u5e38\u8981\u9762\u5bf9\u7684\u4e09\u4e2a\u6838\u5fc3\u6982\u5ff5\u3002\u7b80\u5355\u6765\u8bf4\uff1a<\/p>\n

    \n
  1. \n

    \u8bef\u5dee\u662f\u6a21\u578b\u9884\u6d4b\u7ed3\u679c\u4e0e\u5b9e\u9645\u503c\u4e4b\u95f4\u7684\u5dee\u5f02\u3002\u5728\u6a21\u578b\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\uff0c\u76ee\u6807\u901a\u5e38\u662f\u5c3d\u53ef\u80fd\u5730\u51cf\u5c11\u8fd9\u79cd\u8bef\u5dee\u3002<\/p>\n<\/li>\n

  2. \n

    \u504f\u5dee\u662f\u6a21\u578b\u9884\u6d4b\u7684\u5e73\u5747\u8bef\u5dee\uff0c\u6216\u8005\u8bf4\u662f\u6a21\u578b\u5bf9\u771f\u5b9e\u6570\u636e\u7684\u9884\u6d4b\u503c\u4e0e\u5b9e\u9645\u503c\u7684\u5dee\u5f02\u7684\u671f\u671b\u503c\u3002\u4e00\u4e2a\u9ad8\u504f\u5dee\u7684\u6a21\u578b\u53ef\u80fd\u4f1a\u5ffd\u7565\u6570\u636e\u4e2d\u7684\u67d0\u4e9b\u91cd\u8981\u7ec6\u8282\uff0c\u5bfc\u81f4\u6a21\u578b\u8fc7\u4e8e\u7b80\u5355\uff0c\u8fd9\u79cd\u60c5\u51b5\u6211\u4eec\u901a\u5e38\u79f0\u4e4b\u4e3a\u6b20\u62df\u5408\u3002<\/p>\n<\/li>\n

  3. \n

    \u65b9\u5dee\u662f\u6a21\u578b\u9884\u6d4b\u503c\u7684\u53d8\u5316\u8303\u56f4\u6216\u8005\u8bf4\u79bb\u6563\u7a0b\u5ea6\uff0c\u5b83\u53cd\u6620\u4e86\u6a21\u578b\u5bf9\u8f93\u5165\u5fae\u5c0f\u6539\u53d8\u7684\u654f\u611f\u5ea6\u3002\u9ad8\u65b9\u5dee\u53ef\u80fd\u5bfc\u81f4\u6a21\u578b\u5bf9\u6570\u636e\u4e2d\u7684\u968f\u673a\u566a\u58f0\u8fc7\u4e8e\u654f\u611f\uff0c\u5bfc\u81f4\u6a21\u578b\u8fc7\u4e8e\u590d\u6742\uff0c\u6211\u4eec\u901a\u5e38\u79f0\u4e4b\u4e3a\u8fc7\u62df\u5408\u3002<\/p>\n<\/li>\n<\/ol>\n

    \u7406\u89e3\u8bef\u5dee\u3001\u504f\u5dee\u548c\u65b9\u5dee\u7684\u533a\u522b\u548c\u8054\u7cfb\u5bf9\u4e8e\u6784\u5efa\u548c\u4f18\u5316\u673a\u5668\u5b66\u4e60\u6a21\u578b\u81f3\u5173\u91cd\u8981\u3002\u7406\u60f3\u7684\u6a21\u578b\u5e94\u8be5\u5728\u504f\u5dee\u548c\u65b9\u5dee\u4e4b\u95f4\u8fbe\u5230\u5e73\u8861\uff0c\u4ee5\u6700\u5c0f\u5316\u603b\u8bef\u5dee\u3002\u8fd9\u5c31\u662f\u6211\u4eec\u6240\u8bf4\u7684\u504f\u5dee-\u65b9\u5dee\u6743\u8861\uff08Bias-Variance Tradeoff\uff09<\/strong>\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u6df1\u5165\u8ba8\u8bba\u8fd9\u4e09\u4e2a\u6982\u5ff5\uff0c\u4ee5\u53ca\u5982\u4f55\u5728\u5b9e\u8df5\u4e2d\u5904\u7406\u5b83\u4eec\u3002<\/p>\n

    \u4e8c\u3001 \u57fa\u7840\u5b9a\u4e49<\/h3>\n

    2.1 \u4ec0\u4e48\u662f\u504f\u5dee(Bias)<\/h4>\n

    2.1.1 \u504f\u5dee\uff08Bias\uff09\u5b9a\u4e49<\/h5>\n

    \u504f\u5dee\uff08Bias\uff09\u5728\u7edf\u8ba1\u548c\u673a\u5668\u5b66\u4e60\u4e2d\u662f\u9884\u6d4b\u503c\u7684\u671f\u671b\uff08\u5e73\u5747\u9884\u6d4b\u503c\uff09\u548c\u771f\u5b9e\u503c\u4e4b\u95f4\u7684\u5dee\u5f02\u3002\u5728\u8fd9\u4e2a\u5b9a\u4e49\u4e2d\uff0c\"\u671f\u671b\"\u6216\"\u5e73\u5747\u9884\u6d4b\u503c\"\u662f\u6307\u5982\u679c\u6211\u4eec\u53cd\u590d\u4ece\u540c\u4e00\u5206\u5e03\u4e2d\u53d6\u6837\u5e76\u8bad\u7ec3\u6a21\u578b\uff0c\u7136\u540e\u5bf9\u76f8\u540c\u7684\u8f93\u5165\u505a\u9884\u6d4b\uff0c\u6240\u6709\u8fd9\u4e9b\u9884\u6d4b\u7684\u5e73\u5747\u503c\u3002\u6240\u4ee5\uff0c\u5c31\u53ef\u4ee5\u628a\u504f\u5dee\u770b\u4f5c\u662f\u6a21\u578b\u9884\u6d4b\u7684\u5e73\u5747\u8bef\u5dee\u3002<\/p>\n

    \u4e3a\u4e86\u66f4\u597d\u5730\u7406\u89e3\u8fd9\u4e2a\u6982\u5ff5\uff0c\u4f60\u53ef\u4ee5\u60f3\u8c61\u6211\u4eec\u6709\u4e00\u4e2a\u771f\u5b9e\u7684\u51fd\u6570\uff08\u6216\u8005\u6570\u636e\u751f\u6210\u8fc7\u7a0b\uff09\uff0c\u4f46\u662f\u6211\u4eec\u6ca1\u6709\u5b8c\u5168\u4e86\u89e3\u5b83\uff0c\u6211\u4eec\u53ea\u80fd\u901a\u8fc7\u6709\u9650\u7684\u6570\u636e\u6837\u672c\u6765\u4f30\u8ba1\u5b83\u3002\u5982\u679c\u6211\u4eec\u7684\u6a21\u578b\uff08\u6bd4\u5982\u4e00\u4e2a\u7ebf\u6027\u56de\u5f52\u6a21\u578b\uff09\u5bf9\u8fd9\u4e2a\u771f\u5b9e\u51fd\u6570\u7684\u5047\u8bbe\u504f\u79bb\u4e86\u5b9e\u9645\uff0c\u90a3\u4e48\u6a21\u578b\u7684\u9884\u6d4b\u5c31\u4f1a\u7cfb\u7edf\u6027\u5730\u504f\u79bb\u771f\u5b9e\u503c\uff0c\u8fd9\u79cd\u504f\u79bb\u5c31\u662f\u504f\u5dee\u3002\u5982\u679c\u4e00\u4e2a\u6a21\u578b\u7684\u504f\u5dee\u9ad8\uff0c\u5c31\u8bf4\u660e\u5b83\u7684\u9884\u6d4b\u5e73\u5747\u4e0a\u504f\u79bb\u4e86\u771f\u5b9e\u503c\u3002<\/p>\n

    \u5728\u6570\u5b66\u4e0a\uff0c\u6211\u4eec\u53ef\u4ee5\u7528\u4ee5\u4e0b\u516c\u5f0f\u6765\u5b9a\u4e49\u504f\u5dee\uff1a<\/p>\n

    Bias ( f ^ ( x ) ) = E [ f ^ ( x ) ] \u2212 f ( x ) (1) \\text{Bias}(\\hat{f}(x)) = E[\\hat{f}(x)] - f(x) \\tag{1} <\/span><\/span>Bias<\/span><\/span>(<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>x<\/span>))<\/span><\/span>=<\/span><\/span><\/span><\/span>E<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>x<\/span>)]<\/span><\/span>\u2212<\/span><\/span><\/span><\/span>f<\/span>(<\/span>x<\/span>)<\/span><\/span><\/span>(<\/span>1<\/span><\/span>)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n

    \u5176\u4e2d\uff0c E [ \u22c5 ] E[\\cdot] <\/span><\/span>E<\/span>[<\/span>\u22c5<\/span>]<\/span><\/span><\/span><\/span><\/span> \u8868\u793a\u671f\u671b\uff08\u5373\u5e73\u5747\u503c\uff09\u7684\u7b26\u53f7\uff0c f ( x ) f(x) <\/span><\/span>f<\/span>(<\/span>x<\/span>)<\/span><\/span><\/span><\/span><\/span> \u662f\u771f\u5b9e\u7684\u51fd\u6570\u503c\uff0c f ^ ( x ) \\hat{f}(x) <\/span><\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>x<\/span>)<\/span><\/span><\/span><\/span><\/span> \u662f\u6a21\u578b\u5bf9\u7ed9\u5b9a\u8f93\u5165 x x <\/span><\/span>x<\/span><\/span><\/span><\/span><\/span> \u7684\u9884\u6d4b\u3002<\/p>\n

    \u504f\u5dee\u8861\u91cf\u4e86\u6a21\u578b\u9884\u6d4b\u7684\u5e73\u5747\u8bef\u5dee\u3002\u9ad8\u504f\u5dee\u53ef\u80fd\u610f\u5473\u7740\u6a21\u578b\u8fc7\u4e8e\u7b80\u5355\uff08\u5373\u6a21\u578b\u6b20\u62df\u5408\uff09\uff0c\u65e0\u6cd5\u6355\u83b7\u6570\u636e\u4e2d\u7684\u6240\u6709\u76f8\u5173\u6027\uff0c\u5bfc\u81f4\u9884\u6d4b\u7ed3\u679c\u504f\u79bb\u771f\u5b9e\u503c\u3002<\/p>\n

    2.1.2 \u504f\u5dee\uff08Bias\uff09\u89e3\u6790<\/h5>\n

    \u6211\u4eec\u901a\u8fc7\u4e00\u4e2a\u7b80\u5355\u7684\u7ebf\u6027\u56de\u5f52\u6a21\u578b\u7684\u4f8b\u5b50\u6765\u7406\u89e3\u5e76\u8ba1\u7b97\u504f\u5dee\u3002<\/p>\n

    \u504f\u5dee\uff08Bias\uff09\u5ea6\u91cf\u4e86\u6a21\u578b\u9884\u6d4b\u7684\u5e73\u5747\u503c\u548c\u771f\u5b9e\u503c\u4e4b\u95f4\u7684\u5dee\u8ddd\u3002\u5728\u7406\u8bba\u4e0a\uff0c\u504f\u5dee\u662f\u6240\u6709\u53ef\u80fd\u8bad\u7ec3\u6570\u636e\u96c6\u4e0a\u6a21\u578b\u9884\u6d4b\u7684\u5e73\u5747\u503c\u4e0e\u771f\u5b9e\u503c\u4e4b\u95f4\u7684\u5dee\u5f02\u3002\u8fd9\u4e2a\u201c\u5e73\u5747\u201d\u662f\u6307\u5728\u6240\u6709\u53ef\u80fd\u7684\u8bad\u7ec3\u96c6\u4e0a\u8fdb\u884c\u5e73\u5747\u3002<\/p>\n

    \u56e0\u4e3a\u6211\u4eec\u65e0\u6cd5\u83b7\u5f97\u6240\u6709\u53ef\u80fd\u7684\u8bad\u7ec3\u96c6\uff0c\u6240\u4ee5\u5728\u5b9e\u9645\u64cd\u4f5c\u4e2d\uff0c\u6211\u4eec\u901a\u5e38\u7528\u5355\u4e2a\u8bad\u7ec3\u96c6\u7684\u6a21\u578b\u9884\u6d4b\u7ed3\u679c\u6765\u8fd1\u4f3c\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c31\u901a\u8fc7\u4e00\u4e2a\u5b9e\u4f8b\u6765\u5177\u4f53\u5c55\u793a\u8fd9\u4e00\u8fc7\u7a0b\u3002\u76f4\u63a5\u4e0a\u4ee3\u7801\uff1a<\/p>\n

    import<\/span> numpy as<\/span> np\nimport<\/span> matplotlib.<\/span>pyplot as<\/span> plt\nfrom<\/span> sklearn.<\/span>linear_model import<\/span> LinearRegression\n\n# \u8bbe\u7f6e\u968f\u673a\u79cd\u5b50\u4ee5\u4fdd\u8bc1\u7ed3\u679c\u7684\u53ef\u590d\u73b0\u6027<\/span>\nnp.<\/span>random.<\/span>seed(<\/span>0<\/span>)<\/span>\n\n# \u751f\u6210\u8f93\u5165\u6570\u636e<\/span>\nx =<\/span> np.<\/span>linspace(<\/span>-<\/span>10<\/span>,<\/span> 10<\/span>,<\/span> 10<\/span>)<\/span>\n\nprint<\/span>(<\/span>\"Input: \"<\/span>,<\/span> y)<\/span>\n\n# \u5b9a\u4e49\u771f\u5b9e\u51fd\u6570<\/span>\ndef<\/span> f<\/span>(<\/span>x)<\/span>:<\/span>\n    return<\/span> 2<\/span> *<\/span> x +<\/span> 3<\/span>\n\n# \u751f\u6210\u5e26\u566a\u58f0\u7684\u76ee\u6807\u6570\u636e<\/span>\ny =<\/span> f(<\/span>x)<\/span> +<\/span> np.<\/span>random.<\/span>normal(<\/span>0<\/span>,<\/span> 2<\/span>,<\/span> size=<\/span>len<\/span>(<\/span>x)<\/span>)<\/span>  # \u6dfb\u52a0\u566a\u58f0<\/span>\n\n# \u62df\u5408\u7ebf\u6027\u6a21\u578b<\/span>\nmodel =<\/span> LinearRegression(<\/span>)<\/span>\nmodel.<\/span>fit(<\/span>x.<\/span>reshape(<\/span>-<\/span>1<\/span>,<\/span> 1<\/span>)<\/span>,<\/span> y)<\/span>\n\n# \u5f97\u5230\u6a21\u578b\u9884\u6d4b<\/span>\ny_pred =<\/span> model.<\/span>predict(<\/span>x.<\/span>reshape(<\/span>-<\/span>1<\/span>,<\/span> 1<\/span>)<\/span>)<\/span>\n\n# \u8ba1\u7b97\u504f\u5dee<\/span>\nbias =<\/span> np.<\/span>mean(<\/span>y_pred -<\/span> f(<\/span>x)<\/span>)<\/span>\n\n\nprint<\/span>(<\/span>\"True value: \"<\/span>,<\/span> y)<\/span>\nprint<\/span>(<\/span>\"Predicted value: \"<\/span>,<\/span> y_pred)<\/span>\nprint<\/span>(<\/span>\"Bias: \"<\/span>,<\/span> bias)<\/span>\n\n# \u53ef\u89c6\u5316<\/span>\nplt.<\/span>scatter(<\/span>x,<\/span> y,<\/span> color=<\/span>'blue'<\/span>,<\/span> label=<\/span>'True value'<\/span>)<\/span>\nplt.<\/span>plot(<\/span>x,<\/span> y_pred,<\/span> color=<\/span>'red'<\/span>,<\/span> label=<\/span>'Predicted value'<\/span>)<\/span>\nplt.<\/span>legend(<\/span>)<\/span>\nplt.<\/span>show(<\/span>)<\/span>\n<\/code><\/pre>\n

    \u4e0a\u8ff0\u4ee3\u7801\u9996\u5148\u521b\u5efa\u4e86\u4e00\u4e2a\u771f\u5b9e\u51fd\u6570f(x) = 2x + 3<\/code>\uff0c\u7136\u540e\u751f\u6210\u4e86\u4e00\u4e9b\u5e26\u566a\u58f0\u7684\u76ee\u6807\u6570\u636e\u3002\u7136\u540e\uff0c\u7528\u8fd9\u4e9b\u6570\u636e\u62df\u5408\u4e86\u4e00\u4e2a\u7ebf\u6027\u56de\u5f52\u6a21\u578b\uff0c\u5e76\u5f97\u5230\u4e86\u6a21\u578b\u7684\u9884\u6d4b\u503cy_pred<\/code>\u3002\u4e4b\u540e\uff0c\u6211\u4eec\u8ba1\u7b97\u4e86\u504f\u5dee\uff0c\u5373\u9884\u6d4b\u503cy_pred<\/code>\u548c\u771f\u5b9e\u51fd\u6570\u503cf(x)<\/code>\u4e4b\u95f4\u7684\u5dee\u7684\u5e73\u5747\u503c\u3002\u6700\u540e\uff0c\u6211\u4eec\u5c06\u771f\u5b9e\u503c\u548c\u9884\u6d4b\u503c\u5728\u56fe\u4e2d\u8fdb\u884c\u4e86\u53ef\u89c6\u5316\uff0c\u53ef\u4ee5\u770b\u51fa\u9884\u6d4b\u503c\u4e0e\u771f\u5b9e\u503c\u4e4b\u95f4\u7684\u5dee\u8ddd\u3002<\/p>\n

    \"\u673a\u5668\u5b66\u4e60(\u4e03)\uff1a<\/p>\n

    \u6211\u4eec\u628a\u6570\u636e\u6574\u7406\u4e00\u4e0b\uff1a<\/p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
    Input<\/th>\nTrue Value<\/th>\nPredicted Value<\/th>\nDifference<\/th>\n<\/tr>\n<\/thead>\n
    -10<\/td>\n-13.47<\/td>\n-13.99<\/td>\n0.52<\/td>\n<\/tr>\n
    -7.8<\/td>\n-11.76<\/td>\n-9.89<\/td>\n-1.87<\/td>\n<\/tr>\n
    -5.6<\/td>\n-6.15<\/td>\n-5.78<\/td>\n-0.37<\/td>\n<\/tr>\n
    -3.3<\/td>\n0.82<\/td>\n-1.68<\/td>\n-2.5<\/td>\n<\/tr>\n
    -1.1<\/td>\n4.51<\/td>\n2.42<\/td>\n-2.09<\/td>\n<\/tr>\n
    1.1<\/td>\n3.27<\/td>\n6.53<\/td>\n3.26<\/td>\n<\/tr>\n
    3.3<\/td>\n11.57<\/td>\n10.63<\/td>\n-0.94<\/td>\n<\/tr>\n
    5.6<\/td>\n13.81<\/td>\n14.74<\/td>\n0.93<\/td>\n<\/tr>\n
    7.8<\/td>\n18.35<\/td>\n18.84<\/td>\n0.49<\/td>\n<\/tr>\n
    10<\/td>\n23.82<\/td>\n22.94<\/td>\n-0.88<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

    \u6b64\u5904\u56db\u820d\u4e94\u5165\u4e86\u6570\u636e\u4ee5\u4fbf\u9605\u8bfb\uff0cDifference\u7684\u8ba1\u7b97\u65b9\u5f0f\u4e3aPredicted Value - True Value<\/code>\uff0c\u56e0\u6b64\u5f53Predicted Value\u5927\u4e8eTrue Value\u65f6\uff0cDifference\u4e3a\u6b63\uff0c\u53cd\u4e4b\u4e3a\u8d1f\u3002<\/p>\n

    \u901a\u8fc7\u89c2\u5bdf\u53ef\u89c6\u5316\u56fe\u5f62\uff0c\u53ef\u4ee5\u770b\u5230\uff0c\u867d\u7136\u9884\u6d4b\u503c\uff08\u7ea2\u7ebf\uff09\u5927\u4f53\u4e0a\u9075\u5faa\u4e86\u771f\u5b9e\u503c\uff08\u84dd\u70b9\uff09\u7684\u8d8b\u52bf\uff0c\u4f46\u5728\u67d0\u4e9b\u70b9\u4e0a\uff0c\u9884\u6d4b\u503c\u4e0e\u771f\u5b9e\u503c\u4e4b\u95f4\u5b58\u5728\u4e00\u4e9b\u5dee\u8ddd\u3002\u8fd9\u4e9b\u5dee\u8ddd\u5c31\u662f\u504f\u5dee\uff08Bias<\/code>\uff09\u7684\u6765\u6e90\u3002\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u8ba1\u7b97\u7684\u504f\u5dee\u503c\u4e3a 1.476\uff0c\u8868\u793a\u6211\u4eec\u7684\u6a21\u578b\u5728\u9884\u6d4b\u65f6\u4f1a\u6709\u4e00\u5b9a\u7a0b\u5ea6\u7684\u504f\u79bb\u771f\u5b9e\u503c\u3002<\/p>\n

    \u5728\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u4e00\u4e2a\u6a21\u578b\u7684\u504f\u5dee\u5c0f\uff0c\u90a3\u4e48\u8868\u793a\u8be5\u6a21\u578b\u7684\u9884\u6d4b\u7ed3\u679c\u8f83\u63a5\u8fd1\u771f\u5b9e\u503c\u3002\u53cd\u4e4b\uff0c\u5982\u679c\u4e00\u4e2a\u6a21\u578b\u7684\u504f\u5dee\u5927\uff0c\u90a3\u4e48\u8868\u793a\u8be5\u6a21\u578b\u7684\u9884\u6d4b\u7ed3\u679c\u4e0e\u771f\u5b9e\u503c\u76f8\u5dee\u8f83\u5927\u3002\u8fd9\u4e5f\u662f\u6211\u4eec\u5728\u5efa\u6a21\u65f6\u9700\u8981\u5173\u6ce8\u5e76\u5c3d\u53ef\u80fd\u964d\u4f4e\u6a21\u578b\u504f\u5dee\u7684\u539f\u56e0\u3002<\/p>\n

    \u63a5\u4e0b\u6765\u6211\u4eec\u518d\u770b\u4e00\u4e0b\u9ad8\u504f\u5dee\u7684 \u60c5\u51b5\uff0c\u901a\u8fc7\u4f7f\u7528\u4e00\u4e2a\u6a21\u578b\uff0c\u5982\u5e38\u6570\u6a21\u578b\u6216\u8005\u7b80\u5355\u7684\u7ebf\u6027\u6a21\u578b\uff0c\u6765\u9884\u6d4b\u975e\u7ebf\u6027\u7684\u6570\u636e\u3002\u4e0b\u9762\u7684\u4ee3\u7801\u751f\u6210\u4e86\u4e00\u4e2a\u5177\u6709\u8f83\u9ad8\u504f\u5dee\u7684\u6a21\u578b\u6765\u62df\u5408\u975e\u7ebf\u6027\u7684\u6570\u636e\uff1a<\/p>\n

    import<\/span> numpy as<\/span> np\nimport<\/span> matplotlib.<\/span>pyplot as<\/span> plt\nfrom<\/span> sklearn.<\/span>linear_model import<\/span> LinearRegression\n\n# \u8bbe\u7f6e\u968f\u673a\u79cd\u5b50\u4ee5\u4fdd\u8bc1\u7ed3\u679c\u7684\u53ef\u590d\u73b0\u6027<\/span>\nnp.<\/span>random.<\/span>seed(<\/span>0<\/span>)<\/span>\n\n# \u751f\u6210\u8f93\u5165\u6570\u636e<\/span>\nx =<\/span> np.<\/span>linspace(<\/span>-<\/span>10<\/span>,<\/span> 10<\/span>,<\/span> 10<\/span>)<\/span>\n\nprint<\/span>(<\/span>\"Input: \"<\/span>,<\/span> y)<\/span>\n\n# \u5b9a\u4e49\u771f\u5b9e\u51fd\u6570\uff0c\u975e\u7ebf\u6027\u51fd\u6570<\/span>\ndef<\/span> f<\/span>(<\/span>x)<\/span>:<\/span>\n    return<\/span> x**<\/span>2<\/span> +<\/span> 2<\/span>*<\/span>x +<\/span> 3<\/span>\n\n# \u751f\u6210\u5e26\u566a\u58f0\u7684\u76ee\u6807\u6570\u636e<\/span>\ny =<\/span> f(<\/span>x)<\/span> +<\/span> np.<\/span>random.<\/span>normal(<\/span>0<\/span>,<\/span> 10<\/span>,<\/span> size=<\/span>len<\/span>(<\/span>x)<\/span>)<\/span>  # \u6dfb\u52a0\u566a\u58f0<\/span>\n\n# \u62df\u5408\u7ebf\u6027\u6a21\u578b\uff0c\u7ebf\u6027\u6a21\u578b\u53ef\u80fd\u4e0d\u80fd\u5f88\u597d\u5730\u62df\u5408\u8fd9\u79cd\u975e\u7ebf\u6027\u6570\u636e<\/span>\nmodel =<\/span> LinearRegression(<\/span>)<\/span>\nmodel.<\/span>fit(<\/span>x.<\/span>reshape(<\/span>-<\/span>1<\/span>,<\/span> 1<\/span>)<\/span>,<\/span> y)<\/span>\n\n# \u5f97\u5230\u6a21\u578b\u9884\u6d4b<\/span>\ny_pred =<\/span> model.<\/span>predict(<\/span>x.<\/span>reshape(<\/span>-<\/span>1<\/span>,<\/span> 1<\/span>)<\/span>)<\/span>\n\n# \u8ba1\u7b97\u504f\u5dee<\/span>\nbias =<\/span> np.<\/span>mean(<\/span>y_pred -<\/span> f(<\/span>x)<\/span>)<\/span>\n\nprint<\/span>(<\/span>\"True value: \"<\/span>,<\/span> y)<\/span>\nprint<\/span>(<\/span>\"Predicted value: \"<\/span>,<\/span> y_pred)<\/span>\nprint<\/span>(<\/span>\"Bias: \"<\/span>,<\/span> bias)<\/span>\n\n# \u53ef\u89c6\u5316<\/span>\nplt.<\/span>scatter(<\/span>x,<\/span> y,<\/span> color=<\/span>'blue'<\/span>,<\/span> label=<\/span>'True value'<\/span>)<\/span>\nplt.<\/span>plot(<\/span>x,<\/span> y_pred,<\/span> color=<\/span>'red'<\/span>,<\/span> label=<\/span>'Predicted value'<\/span>)<\/span>\nplt.<\/span>legend(<\/span>)<\/span>\nplt.<\/span>show(<\/span>)<\/span>\n<\/code><\/pre>\n

    \u8fd9\u4e2a\u4ee3\u7801\u4e2d\uff0c\u771f\u5b9e\u51fd\u6570\u662f\u4e00\u4e2a\u4e8c\u6b21\u51fd\u6570\uff0c\u800c\u6211\u4eec\u4f7f\u7528\u4e86\u7ebf\u6027\u6a21\u578b\u53bb\u62df\u5408\uff0c\u6240\u4ee5\u504f\u5dee\u4f1a\u6bd4\u8f83\u5927\uff0c\u8fd9\u6837\u5c31\u80fd\u6e05\u695a\u5730\u5c55\u793a\u9ad8\u504f\u5dee\u7684\u60c5\u51b5\u3002<\/p>\n

    \"\u673a\u5668\u5b66\u4e60(\u4e03)\uff1a<\/p>\n

    \u6700\u540e\u6765\u5bf9\u6bd4\u4e00\u4e0b<\/p>\n

    \"\u673a\u5668\u5b66\u4e60(\u4e03)\uff1a<\/p>\n

    2.2 \u4ec0\u4e48\u662f\u65b9\u5dee(Variance)<\/h4>\n

    2.2.1 \u65b9\u5dee(Variance)\u5b9a\u4e49<\/h5>\n

    \u5728\u7edf\u8ba1\u548c\u673a\u5668\u5b66\u4e60\u4e2d\uff0c\u65b9\u5dee\u662f\u4e00\u4e2a\u8861\u91cf\u9884\u6d4b\u503c\u5206\u6563\u7a0b\u5ea6\u7684\u91cf\u3002\u5982\u679c\u6211\u4eec\u6709\u4e00\u7ec4\u9884\u6d4b\u503c\uff0c\u6211\u4eec\u53ef\u4ee5\u9996\u5148\u8ba1\u7b97\u8fd9\u7ec4\u9884\u6d4b\u503c\u7684\u5747\u503c\uff0c\u7136\u540e\u8ba1\u7b97\u6bcf\u4e2a\u9884\u6d4b\u503c\u4e0e\u8fd9\u4e2a\u5747\u503c\u7684\u5dee\u7684\u5e73\u65b9\uff0c\u6700\u540e\u8ba1\u7b97\u8fd9\u4e9b\u5e73\u65b9\u5dee\u7684\u5e73\u5747\u503c\uff0c\u5f97\u5230\u7684\u5c31\u662f\u8fd9\u7ec4\u9884\u6d4b\u503c\u7684\u65b9\u5dee\u3002\u66f4\u9ad8\u7684\u65b9\u5dee\u610f\u5473\u7740\u9884\u6d4b\u503c\u5728\u5176\u5747\u503c\u9644\u8fd1\u7684\u5206\u6563\u7a0b\u5ea6\u66f4\u9ad8\u3002<\/p>\n

    \u5728\u673a\u5668\u5b66\u4e60\u4e2d\uff0c\u901a\u5e38\u5c06\u65b9\u5dee\u5b9a\u4e49\u4e3a\u4f7f\u7528\u4e0d\u540c\u7684\u8bad\u7ec3\u6570\u636e\u96c6\u8bad\u7ec3\u51fa\u7684\u6a21\u578b\u5bf9\u76f8\u540c\u7684\u8f93\u5165\u503c x \u7684\u9884\u6d4b\u7684\u5dee\u5f02\u3002\u65b9\u5dee\u7684\u6570\u5b66\u5b9a\u4e49\u662f\uff1a<\/p>\n

    Variance = E [ ( f ^ ( x ) \u2212 E [ f ^ ( x ) ] ) 2 ] (2) \\text{Variance} = E[(\\hat{f}(x) - E[\\hat{f}(x)])^2] \\tag{2} <\/span><\/span>Variance<\/span><\/span><\/span>=<\/span><\/span><\/span><\/span>E<\/span>[(<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>x<\/span>)<\/span><\/span>\u2212<\/span><\/span><\/span><\/span>E<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>x<\/span>)]<\/span>)<\/span><\/span>2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span><\/span><\/span>(<\/span>2<\/span><\/span>)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n

    \u5728\u8fd9\u4e2a\u516c\u5f0f\u4e2d\uff0c f ^ ( x ) \\hat{f}(x) <\/span><\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>x<\/span>)<\/span><\/span><\/span><\/span><\/span>\u662f\u6a21\u578b\u5bf9\u8f93\u5165 x x <\/span><\/span>x<\/span><\/span><\/span><\/span><\/span>\u7684\u9884\u6d4b\uff0c E [ f ^ ( x ) ] E[\\hat{f}(x)] <\/span><\/span>E<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>x<\/span>)]<\/span><\/span><\/span><\/span><\/span>\u662f\u6240\u6709\u53ef\u80fd\u6a21\u578b\u9884\u6d4b\u503c\u7684\u671f\u671b\uff08\u5e73\u5747\u503c\uff09\u3002\u8fd9\u4e2a\u516c\u5f0f\u8868\u793a\u7684\u662f\u6a21\u578b\u9884\u6d4b\u7684\u671f\u671b\u503c\u548c\u6bcf\u4e00\u4e2a\u6a21\u578b\u9884\u6d4b\u503c\u4e4b\u95f4\u7684\u5e73\u65b9\u5dee\u5f02\u7684\u671f\u671b\u503c\uff0c\u8861\u91cf\u4e86\u6a21\u578b\u9884\u6d4b\u7684\u53d8\u5316\u7a0b\u5ea6\u3002<\/p>\n

    2.2.2 \u65b9\u5dee(Variance)\u89e3\u6790<\/h5>\n

    \u540c\u6837\uff0c\u6211\u4eec\u6a21\u62df\u4e00\u4e2a\u4f4e\u65b9\u5dee\u7684\u60c5\u51b5\u3002\u4f4e\u65b9\u5dee\u610f\u5473\u7740\u4e0d\u540c\u6a21\u578b\u7684\u9884\u6d4b\u7ed3\u679c\u975e\u5e38\u63a5\u8fd1\uff0c\u5373\u4f7f\u5728\u8f93\u5165\u6570\u636e\u4e2d\u52a0\u5165\u4e86\u4e00\u4e9b\u566a\u58f0\u3002\u76f4\u63a5\u4e0a\u4ee3\u7801\uff1a<\/p>\n

    import<\/span> numpy as<\/span> np\nimport<\/span> matplotlib.<\/span>pyplot as<\/span> plt\nfrom<\/span> sklearn.<\/span>linear_model import<\/span> LinearRegression\n\n# \u8bbe\u7f6e\u968f\u673a\u79cd\u5b50\u4ee5\u4fdd\u8bc1\u7ed3\u679c\u7684\u53ef\u590d\u73b0\u6027<\/span>\nnp.<\/span>random.<\/span>seed(<\/span>0<\/span>)<\/span>\n\n# \u751f\u6210\u8f93\u5165\u6570\u636e<\/span>\nx =<\/span> np.<\/span>linspace(<\/span>-<\/span>10<\/span>,<\/span> 10<\/span>,<\/span> 10<\/span>)<\/span>\n\n\n# \u5b9a\u4e49\u771f\u5b9e\u51fd\u6570<\/span>\ndef<\/span> f<\/span>(<\/span>x)<\/span>:<\/span>\n    return<\/span> 2<\/span> *<\/span> x +<\/span> 3<\/span>\n\n# \u751f\u6210\u771f\u5b9e\u76ee\u6807\u6570\u636e<\/span>\ny_true =<\/span> f(<\/span>x)<\/span>\n\n# \u521b\u5efa\u6a21\u578b\u5e76\u8fdb\u884c\u591a\u6b21\u62df\u5408<\/span>\npredictions =<\/span> [<\/span>]<\/span>\n\nfor<\/span> _ in<\/span> range<\/span>(<\/span>100<\/span>)<\/span>:<\/span>\n    # \u4e3a\u76ee\u6807\u6570\u636e\u6dfb\u52a0\u566a\u58f0<\/span>\n    y =<\/span> y_true +<\/span> np.<\/span>random.<\/span>normal(<\/span>0<\/span>,<\/span> 1<\/span>,<\/span> size=<\/span>len<\/span>(<\/span>x)<\/span>)<\/span>  # \u589e\u5927\u566a\u58f0\u7684\u6807\u51c6\u5dee<\/span>\n\n    # \u62df\u5408\u7ebf\u6027\u6a21\u578b<\/span>\n    model =<\/span> LinearRegression(<\/span>)<\/span>\n    model.<\/span>fit(<\/span>x.<\/span>reshape(<\/span>-<\/span>1<\/span>,<\/span> 1<\/span>)<\/span>,<\/span> y)<\/span>\n\n    # \u5f97\u5230\u6a21\u578b\u9884\u6d4b<\/span>\n    y_pred =<\/span> model.<\/span>predict(<\/span>x.<\/span>reshape(<\/span>-<\/span>1<\/span>,<\/span> 1<\/span>)<\/span>)<\/span>\n    predictions.<\/span>append(<\/span>y_pred)<\/span>\n\n# \u8ba1\u7b97\u65b9\u5dee<\/span>\nvariance =<\/span> np.<\/span>var(<\/span>predictions,<\/span> axis=<\/span>0<\/span>)<\/span>\nprint<\/span>(<\/span>\"Variance: \"<\/span>,<\/span> variance)<\/span>\n\n# \u53ef\u89c6\u5316<\/span>\nplt.<\/span>figure(<\/span>figsize=<\/span>(<\/span>10<\/span>,<\/span> 6<\/span>)<\/span>)<\/span>\nplt.<\/span>plot(<\/span>x,<\/span> y_true,<\/span> color=<\/span>'black'<\/span>,<\/span> label=<\/span>'True function'<\/span>)<\/span>\nfor<\/span> i,<\/span> y_pred in<\/span> enumerate<\/span>(<\/span>predictions)<\/span>:<\/span>\n    plt.<\/span>plot(<\/span>x,<\/span> y_pred,<\/span> color=<\/span>'blue'<\/span>,<\/span> alpha=<\/span>0.1<\/span>)<\/span>\nplt.<\/span>legend(<\/span>)<\/span>\nplt.<\/span>show(<\/span>)<\/span>\n<\/code><\/pre>\n

    \u5728\u5b9e\u9645\u60c5\u51b5\u4e2d\uff0c\u7531\u4e8e\u901a\u5e38\u53ea\u6709\u4e00\u4e2a\u6570\u636e\u96c6\uff0c\u56e0\u6b64\u65e0\u6cd5\u751f\u6210\u4e0d\u540c\u7684\u6570\u636e\u96c6\u4ee5\u663e\u793a\u65b9\u5dee\u3002\u4f46\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u751f\u6210\u4e0d\u540c\u7684\u6570\u636e\u5b50\u96c6\uff08\u4f8b\u5982\uff0c\u901a\u8fc7\u5f15\u5165\u566a\u58f0\u6216\u91c7\u6837\uff09\u6765\u6a21\u62df\u8fd9\u79cd\u60c5\u51b5\u3002<\/p>\n

    \u5728\u4e0a\u8ff0\u4ee3\u7801\u4e2d\uff0c\u751f\u621010\u4e2a\u7ebf\u6027\u6a21\u578b\uff0c\u6bcf\u4e2a\u6a21\u578b\u90fd\u7528\u76f8\u540c\u7684\u6570\u636e\u96c6\u8bad\u7ec3\uff0c\u4f46\u5728\u6570\u636e\u4e2d\u6dfb\u52a0\u4e86\u4e0d\u540c\u7684\u566a\u58f0\u3002\u7136\u540e\uff0c\u753b\u51fa\u6240\u6709\u6a21\u578b\u7684\u9884\u6d4b\u4ee5\u663e\u793a\u9884\u6d4b\u7ed3\u679c\u7684\u5206\u6563\u60c5\u51b5\u3002<\/p>\n

    \"\u673a\u5668\u5b66\u4e60(\u4e03)\uff1a<\/p>\n

    \u770b\u5230\u7684\u84dd\u8272\u7ebf\u5176\u5b9e\u662f\u753110\u6761\u7ebf\u53e0\u52a0\u5728\u4e00\u8d77\u5f62\u6210\u7684\u3002\u56e0\u4e3a\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u7684\u662f\u7ebf\u6027\u6a21\u578b\u6765\u62df\u5408\u7ebf\u6027\u6570\u636e\uff0c\u6240\u4ee5\u6240\u6709\u7684\u6a21\u578b\u90fd\u53ef\u4ee5\u5f88\u597d\u5730\u62df\u5408\u51fa\u771f\u5b9e\u7684\u6a21\u5f0f\uff0c\u56e0\u6b64\u9884\u6d4b\u7ed3\u679c\u7684\u5dee\u5f02\u5f88\u5c0f\uff0c\u770b\u4e0a\u53bb\u5c31\u50cf\u4e00\u6761\u7ebf\u3002\u8fd9\u5c31\u662f\u4f4e\u65b9\u5dee\u7684\u8868\u73b0\uff1a\u4e0d\u540c\u6a21\u578b\u7684\u9884\u6d4b\u7ed3\u679c\u975e\u5e38\u63a5\u8fd1\u3002<\/p>\n

    \u4f46\u5982\u679c\u6211\u4eec\u4f7f\u7528\u590d\u6742\u7684\u6a21\u578b\uff08\u5982\u6df1\u5ea6\u795e\u7ecf\u7f51\u7edc\uff09\u6216\u8005\u5728\u6570\u636e\u4e2d\u6dfb\u52a0\u66f4\u591a\u7684\u566a\u58f0\uff0c\u5c31\u4f1a\u770b\u5230\u9884\u6d4b\u7ed3\u679c\u4e4b\u95f4\u7684\u5dee\u5f02\u4f1a\u53d8\u5927\uff0c\u8fd9\u65f6\u5019\u5c31\u4f1a\u4f53\u73b0\u51fa\u9ad8\u65b9\u5dee\u7684\u7279\u6027\u3002<\/p>\n

    \u8981\u60f3\u8ba9\u9884\u6d4b\u7ed3\u679c\u7684\u5dee\u5f02\u5728\u56fe\u4e2d\u66f4\u52a0\u660e\u663e\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u589e\u5927\u566a\u58f0\u7684\u6807\u51c6\u5dee\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5c06\u566a\u58f0\u7684\u6807\u51c6\u5dee\u4ece1\u589e\u5927\u52305\uff0c\u4f60\u5c31\u53ef\u4ee5\u770b\u5230\u66f4\u5927\u7684\u9884\u6d4b\u5dee\u5f02\u3002<\/p>\n

    # \u4fee\u6539\u8fd9\u4e00\u884c\u4ee3\u7801\uff0c\u5c061\u6539\u4e3a5\uff0c\u518d\u6b21\u8fd0\u884c<\/span>\ny =<\/span> y_true +<\/span> np.<\/span>random.<\/span>normal(<\/span>0<\/span>,<\/span> 5<\/span>,<\/span> size=<\/span>len<\/span>(<\/span>x)<\/span>)<\/span>  # \u589e\u5927\u566a\u58f0\u7684\u6807\u51c6\u5dee<\/span>\n<\/code><\/pre>\n

    \"\u673a\u5668\u5b66\u4e60(\u4e03)\uff1a<\/p>\n

    \u6700\u540e\u5bf9\u6bd4\u770b\u4e00\u4e0b\uff1a<\/p>\n

    \"\u673a\u5668\u5b66\u4e60(\u4e03)\uff1a<\/p>\n

    2.3 \u4ec0\u4e48\u662f\u8bef\u5dee(Error)<\/h4>\n

    2.3.1 \u8bef\u5dee(Error)\u5b9a\u4e49<\/h5>\n

    \u5728\u7edf\u8ba1\u5b66\u548c\u673a\u5668\u5b66\u4e60\u4e2d\uff0c\u8bef\u5dee<\/strong>\u901a\u5e38\u88ab\u5b9a\u4e49\u4e3a\u9884\u6d4b\u503c\u548c\u771f\u5b9e\u503c\u4e4b\u95f4\u7684\u5dee\u5f02\u3002\u8bef\u5dee\u8861\u91cf\u4e86\u6a21\u578b\u9884\u6d4b\u7684\u51c6\u786e\u6027\u3002\u5bf9\u4e8e\u5355\u4e2a\u6570\u636e\u70b9\uff0c\u8bef\u5dee\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u516c\u5f0f\u8ba1\u7b97\uff1a\u8bef\u5dee = \u771f\u5b9e\u503c - \u9884\u6d4b\u503c<\/p>\n

    \u5728\u4e00\u4e2a\u5b8c\u7f8e\u7684\u9884\u6d4b\u6a21\u578b\u4e2d\uff0c\u6240\u6709\u9884\u6d4b\u503c\u90fd\u5c06\u4e0e\u771f\u5b9e\u503c\u5b8c\u5168\u5339\u914d\uff0c\u56e0\u6b64\u8bef\u5dee\u5c06\u4e3a\u96f6\u3002\u7136\u800c\uff0c\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u7531\u4e8e\u591a\u79cd\u56e0\u7d20\uff08\u4f8b\u5982\u6570\u636e\u566a\u58f0\u3001\u6a21\u578b\u590d\u6742\u6027\u3001\u8fc7\u5ea6\u62df\u5408\u6216\u6b20\u62df\u5408\u7b49\uff09\u7684\u5f71\u54cd\uff0c\u9884\u6d4b\u8bef\u5dee\u901a\u5e38\u4e0d\u4f1a\u4e3a\u96f6\u3002<\/p>\n

    \u5bf9\u4e8e\u4e00\u7ec4\u6570\u636e\u70b9\uff0c\u901a\u5e38\u4f7f\u7528\u5e73\u5747\u8bef\u5dee\uff08Mean Error\uff09\u6216\u5747\u65b9\u8bef\u5dee\uff08Mean Squared Error, MSE\uff09\u6765\u8861\u91cf\u6a21\u578b\u7684\u603b\u4f53\u9884\u6d4b\u51c6\u786e\u6027\u3002\u5747\u65b9\u8bef\u5dee\u662f\u6700\u5e38\u7528\u7684\u8bef\u5dee\u5ea6\u91cf\uff0c\u5b83\u662f\u6bcf\u4e2a\u9884\u6d4b\u8bef\u5dee\u5e73\u65b9\u7684\u5e73\u5747\u503c\u3002\u5747\u65b9\u8bef\u5dee\u7684\u516c\u5f0f\u4e3a\uff1a<\/p>\n

    M S E = 1 n \u2211 i = 1 n ( y i \u2212 y i \u2032 ) 2 (3) MSE = \\frac{1}{n} \\sum_{i=1}^{n}(y_i - y'_i)^2 \\tag{3} <\/span><\/span>MSE<\/span><\/span>=<\/span><\/span><\/span><\/span><\/span><\/span>n<\/span><\/span><\/span><\/span><\/span><\/span><\/span>1<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>i<\/span>=<\/span>1<\/span><\/span><\/span><\/span><\/span>\u2211<\/span><\/span><\/span><\/span>n<\/span><\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>y<\/span><\/span>i<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>\u2212<\/span><\/span><\/span><\/span>y<\/span><\/span>i<\/span><\/span><\/span><\/span>\u2032<\/span><\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>)<\/span><\/span>2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>3<\/span><\/span>)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n

    \u5176\u4e2d\uff1a<\/p>\n

      \n
    • n \u662f\u6570\u636e\u70b9\u7684\u603b\u6570<\/li>\n
    • y i y_i <\/span><\/span>y<\/span><\/span>i<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span> \u662f\u771f\u5b9e\u503c<\/li>\n
    • y i \u2032 y'_i <\/span><\/span>y<\/span><\/span>i<\/span><\/span><\/span><\/span>\u2032<\/span><\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span> \u662f\u9884\u6d4b\u503c<\/li>\n
    • \u03a3 \u8868\u793a\u5bf9\u6240\u6709\u6570\u636e\u70b9\u8fdb\u884c\u6c42\u548c<\/li>\n<\/ul>\n

      \u2003\u2003\u8fd9\u4e2a\u6982\u5ff5\u6bd4\u8f83\u5bb9\u6613\u7406\u89e3\uff0c\u5c31\u4e0d\u4e3e\u4f8b\u8bf4\u660e\u4e86\u3002<\/p>\n

      \u4e09\u3001Bias\uff0cVariance\u4ee5\u53caError\u7684\u5173\u7cfb<\/h3>\n

      \u2003\u2003\u8bef\u5dee\u3001\u504f\u5dee\u548c\u65b9\u5dee\u867d\u7136\u6709\u5173\u8054\uff0c\u4f46\u662f\u5b83\u4eec\u8861\u91cf\u7684\u662f\u4e0d\u540c\u7684\u6982\u5ff5\u3002\u504f\u5dee\u548c\u65b9\u5dee\u90fd\u662f\u8bef\u5dee\u7684\u7ec4\u6210\u90e8\u5206\uff0c\u5b83\u4eec\u5206\u522b\u63cf\u8ff0\u4e86\u6a21\u578b\u9884\u6d4b\u7684\u7cfb\u7edf\u6027\u504f\u79bb\uff08Bias\uff09\u548c\u4e0d\u7a33\u5b9a\u6027\uff08Variance\uff09\u3002\u6a21\u578b\u7684\u603b\u8bef\u5dee\u53ef\u4ee5\u89c6\u4e3a\u504f\u5dee\u3001\u65b9\u5dee\u548c\u566a\u58f0\u7684\u603b\u548c\u3002<\/p>\n

      3.1 \u504f\u5dee-\u65b9\u5dee\u6743\u8861\uff08bias-variance tradeoff\uff09<\/h4>\n

      \u4e3e\u4e2a\u4f8b\u5b50\uff1a<\/p>\n

      \u5728\u4e00\u4e2a\u5b66\u4e60\u4efb\u52a1\u4e2d\uff0c\u5047\u8bbe\u6709\u4e00\u4e2a\u771f\u5b9e\u7684\u51fd\u6570 f f <\/span><\/span>f<\/span><\/span><\/span><\/span><\/span>\uff08\u4e5f\u88ab\u79f0\u4e3a\u76ee\u6807\u51fd\u6570\uff09\uff0c\u6211\u4eec\u5e0c\u671b\u4ece\u8bad\u7ec3\u6570\u636e\uff08\u5305\u542bn\u4e2a\u6837\u672c\u7684\u96c6\u5408D\uff09\u4e2d\u5b66\u4e60\u5230\u4e00\u4e2a\u51fd\u6570 f ^ \\hat f <\/span><\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>\uff0c\u4f7f\u5176\u5c3d\u53ef\u80fd\u63a5\u8fd1 f f <\/span><\/span>f<\/span><\/span><\/span><\/span><\/span>\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u53ef\u4ee5\u88ab\u89c6\u4e3a\u4e00\u4e2a\u56de\u5f52\u95ee\u9898\uff0c\u5176\u4e2d\u901a\u5e38\u4f7f\u7528\u6700\u5c0f\u5316\u5747\u65b9\u8bef\u5dee\uff08MSE\uff09\u7684\u65b9\u5f0f\u6765\u8fdb\u884c\u5b66\u4e60\u3002<\/p>\n

      \u7136\u800c\uff0c\u6211\u4eec\u7684\u6700\u7ec8\u76ee\u6807\u4e0d\u4ec5\u4ec5\u662f\u5728\u8bad\u7ec3\u6570\u636e\u4e0a\u8868\u73b0\u597d\uff0c\u800c\u662f\u5e0c\u671b\u5b66\u4e60\u5230\u7684\u51fd\u6570$ \\hat f$ \u80fd\u591f\u5f88\u597d\u5730\u6cdb\u5316\u5230\u6ca1\u6709\u89c1\u8fc7\u7684\u6837\u672c\u4e0a\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u6211\u4eec\u5e0c\u671b\u65e0\u8bba\u5982\u4f55\u62bd\u6837\u8bad\u7ec3\u6837\u672c\uff0c$ \\hat f$ \u90fd\u80fd\u5bf9\u672a\u89c1\u8fc7\u7684\u6837\u672c\u6709\u826f\u597d\u7684\u8868\u73b0\u3002\u4e3a\u4e86\u8861\u91cf\u8fd9\u4e00\u70b9\uff0c\u6211\u4eec\u8003\u8651\u4e86\u671f\u671b\u7684\u635f\u5931\uff08\u4e5f\u5c31\u662f\u771f\u5b9e\u503c y y <\/span><\/span>y<\/span><\/span><\/span><\/span><\/span> \u548c\u9884\u6d4b\u503c$ \\hat f(x) $\u4e4b\u95f4\u7684\u5dee\u7684\u5e73\u65b9\u7684\u671f\u671b\u503c\uff09\u3002<\/p>\n

      \u7136\u540e\u53ef\u4ee5\u628a\u8fd9\u4e2a\u671f\u671b\u7684\u635f\u5931\u5206\u89e3\u4e3a\u4e09\u4e2a\u90e8\u5206\uff1a\u504f\u5dee\uff0c\u65b9\u5dee\u4ee5\u53ca\u566a\u58f0\u3002\u8fd9\u4e09\u90e8\u5206\u5206\u522b\u53cd\u6620\u4e86\u4e0d\u540c\u7684\u4fe1\u606f\uff1a<\/p>\n

        \n
      • \u504f\u5dee\uff1a\u53cd\u6620\u6a21\u578b\u4e0e\u771f\u5b9e\u6a21\u578b\u4e4b\u95f4\u7684\u8bef\u5dee\u3002\u5982\u679c\u504f\u5dee\u8f83\u5927\uff0c\u90a3\u8bf4\u660e\u6a21\u578b\u7cfb\u7edf\u6027\u5730\u9884\u6d4b\u4e0d\u51c6\uff0c\u4e5f\u5c31\u662f\u8bf4\u6a21\u578b\u53ef\u80fd\u8fc7\u4e8e\u7b80\u5355\uff0c\u6ca1\u6709\u5b66\u4e60\u5230\u6570\u636e\u7684\u771f\u5b9e\u7ed3\u6784\u3002<\/li>\n
      • \u65b9\u5dee\uff1a\u53cd\u6620\u4e86\u6a21\u578b\u5bf9\u8bad\u7ec3\u6570\u636e\u7684\u53d8\u5316\u654f\u611f\u5ea6\u3002\u5982\u679c\u65b9\u5dee\u8f83\u5927\uff0c\u8bf4\u660e\u6a21\u578b\u8fc7\u4e8e\u590d\u6742\uff0c\u4ee5\u81f3\u4e8e\u5bf9\u8bad\u7ec3\u6570\u636e\u4e2d\u7684\u968f\u673a\u566a\u58f0\u90fd\u8fdb\u884c\u4e86\u5b66\u4e60\uff0c\u4ece\u800c\u5bfc\u81f4\u5728\u65b0\u7684\u6570\u636e\u4e0a\u8868\u73b0\u4e0d\u4f73\u3002<\/li>\n
      • \u566a\u58f0\uff1a\u8fd9\u662f\u6570\u636e\u672c\u8eab\u7684\u95ee\u9898\uff0c\u662f\u4e0d\u53ef\u907f\u514d\u7684\u8bef\u5dee\u3002<\/li>\n<\/ul>\n

        3.2 \u6570\u5b66\u63a8\u5bfc<\/h4>\n

        \u76ee\u6807\u662f\u4ece\u91c7\u6837\u7684\u6570\u636e\u96c6 D = { ( x 1 , y 1 ) , \u2026 , ( x n , y n ) } D = \\{(x_1, y_1), \\ldots, (x_n, y_n)\\} <\/span><\/span>D<\/span><\/span>=<\/span><\/span><\/span><\/span>{(<\/span>x<\/span><\/span>1<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>,<\/span><\/span>y<\/span><\/span>1<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>)<\/span>,<\/span><\/span>\u2026<\/span><\/span>,<\/span><\/span>(<\/span>x<\/span><\/span>n<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>,<\/span><\/span>y<\/span><\/span>n<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>)}<\/span><\/span><\/span><\/span><\/span> \u5b66\u4e60\u5230\u4e00\u4e2a\u51fd\u6570 f ^ \\hat{f} <\/span><\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>\uff0c\u4f7f\u5176\u5c3d\u53ef\u80fd\u63a5\u8fd1\u771f\u5b9e\u7684\u51fd\u6570 f f <\/span><\/span>f<\/span><\/span><\/span><\/span><\/span>\u3002\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u76ee\u6807\u503c y y <\/span><\/span>y<\/span><\/span><\/span><\/span><\/span> \u662f\u7531\u771f\u5b9e\u51fd\u6570 f f <\/span><\/span>f<\/span><\/span><\/span><\/span><\/span> \u4ea7\u751f\u7684\u7ed3\u679c\u52a0\u4e0a\u4e00\u4e2a\u566a\u97f3 \u03f5 \\epsilon <\/span><\/span>\u03f5<\/span><\/span><\/span><\/span><\/span>\uff0c\u5373
        y = f ( x ) + \u03f5 (4) y = f(x) + \\epsilon \\tag{4} <\/span><\/span>y<\/span><\/span>=<\/span><\/span><\/span><\/span>f<\/span>(<\/span>x<\/span>)<\/span><\/span>+<\/span><\/span><\/span><\/span>\u03f5<\/span><\/span><\/span>(<\/span>4<\/span><\/span>)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n

        \u6211\u4eec\u5e0c\u671b\u4f18\u5316\u7684\u662f\u671f\u671b\u7684\u635f\u5931\uff08expected loss\uff09\uff0c\u4e5f\u5c31\u662f\u771f\u5b9e\u503c y y <\/span><\/span>y<\/span><\/span><\/span><\/span><\/span> \u548c\u9884\u6d4b\u503c f ^ ( x ) \\hat{f}(x) <\/span><\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>x<\/span>)<\/span><\/span><\/span><\/span><\/span> \u4e4b\u95f4\u7684\u5dee\u7684\u5e73\u65b9\u7684\u671f\u671b\u503c\u3002\u6240\u4ee5\uff1a<\/p>\n

          \n
        1. \n

          \u9996\u5148\uff0c\u8003\u8651\u603b\u7684\u9884\u6d4b\u8bef\u5dee\u7684\u671f\u671b\u503c\uff0c\u4e5f\u5c31\u662f\u5e73\u5747\u8bef\u5dee\u7684\u5e73\u65b9\uff1a<\/p>\n

          E D [ ( y \u2212 f ^ D ( x ) ) 2 ] (5) ED [(y - \\hat{f}_D(x))^2] \\tag{5} <\/span><\/span>E<\/span>D<\/span>[(<\/span>y<\/span><\/span>\u2212<\/span><\/span><\/span><\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>x<\/span>)<\/span>)<\/span><\/span>2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span><\/span><\/span>(<\/span>5<\/span><\/span>)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<\/li>\n

        2. \n

          \u63a5\u4e0b\u6765\uff0c\u5c06 y y <\/span><\/span>y<\/span><\/span><\/span><\/span><\/span> \u66ff\u6362\u4e3a f ( x ) + \u03f5 f(x) + \\epsilon <\/span><\/span>f<\/span>(<\/span>x<\/span>)<\/span><\/span>+<\/span><\/span><\/span><\/span>\u03f5<\/span><\/span><\/span><\/span><\/span>\uff0c\u540c\u65f6\u5c06\u9884\u6d4b\u503c f ^ D ( x ) \\hat{f}_D(x) <\/span><\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>x<\/span>)<\/span><\/span><\/span><\/span><\/span> \u62c6\u5206\u4e3a\u4e24\u90e8\u5206\uff1a\u771f\u5b9e\u51fd\u6570 f ( x ) f(x) <\/span><\/span>f<\/span>(<\/span>x<\/span>)<\/span><\/span><\/span><\/span><\/span> \u4e0e\u9884\u6d4b\u51fd\u6570\u671f\u671b\u503c E D [ f ^ D ] ED[\\hat{f}_D] <\/span><\/span>E<\/span>D<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span><\/span><\/span><\/span><\/span> \u7684\u5dee\uff0c\u4ee5\u53ca\u9884\u6d4b\u51fd\u6570 f ^ D ( x ) \\hat{f}_D(x) <\/span><\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>x<\/span>)<\/span><\/span><\/span><\/span><\/span> \u4e0e\u5b83\u7684\u671f\u671b E D [ f ^ D ] ED[\\hat{f}_D] <\/span><\/span>E<\/span>D<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span><\/span><\/span><\/span><\/span> \u7684\u5dee\u3002\u8fd9\u6837\u5f97\u5230\uff1a<\/p>\n

          E D [ ( f \u2212 E D [ f ^ D ] + f ^ D \u2212 E D [ f ^ D ] + \u03f5 ) 2 ] (6) ED [(f - ED[\\hat{f}_D] + \\hat{f}_D - ED[\\hat{f}_D] + \\epsilon)^2] \\tag{6} <\/span><\/span>E<\/span>D<\/span>[(<\/span>f<\/span><\/span>\u2212<\/span><\/span><\/span><\/span>E<\/span>D<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span><\/span>+<\/span><\/span><\/span><\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>\u2212<\/span><\/span><\/span><\/span>E<\/span>D<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span><\/span>+<\/span><\/span><\/span><\/span>\u03f5<\/span>)<\/span><\/span>2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span><\/span><\/span>(<\/span>6<\/span><\/span>)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<\/li>\n

        3. \n

          \u5728\u4e0a\u4e00\u6b65\u7684\u57fa\u7840\u4e0a\uff0c\u5c06\u516c\u5f0f\u8fdb\u4e00\u6b65\u5c55\u5f00\u4e3a\u4e09\u90e8\u5206\uff1a\u771f\u5b9e\u51fd\u6570\u4e0e\u9884\u6d4b\u51fd\u6570\u671f\u671b\u503c\u7684\u5dee\u7684\u5e73\u65b9\uff0c\u9884\u6d4b\u51fd\u6570\u4e0e\u9884\u6d4b\u51fd\u6570\u671f\u671b\u503c\u7684\u5dee\u7684\u5e73\u65b9\uff0c\u4ee5\u53ca\u566a\u58f0\u7684\u5e73\u65b9\uff1a<\/p>\n

          E D [ ( f \u2212 E D [ f ^ D ] ) 2 + ( f ^ D \u2212 E D [ f ^ D ] ) 2 + \u03f5 2 ] (7) ED [(f - ED[\\hat{f}_D])^2 + (\\hat{f}_D - ED[\\hat{f}_D])^2 + \\epsilon^2] \\tag{7} <\/span><\/span>E<\/span>D<\/span>[(<\/span>f<\/span><\/span>\u2212<\/span><\/span><\/span><\/span>E<\/span>D<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span>)<\/span><\/span>2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>+<\/span><\/span><\/span><\/span>(<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>\u2212<\/span><\/span><\/span><\/span>E<\/span>D<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span>)<\/span><\/span>2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>+<\/span><\/span><\/span><\/span>\u03f5<\/span><\/span>2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span><\/span><\/span>(<\/span>7<\/span><\/span>)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<\/li>\n

        4. \n

          \u6700\u540e\uff0c\u53ef\u4ee5\u770b\u51fa\uff0c\u8fd9\u4e09\u90e8\u5206\u5206\u522b\u5bf9\u5e94\u504f\u5dee\u7684\u5e73\u65b9 B i a s [ f ^ D ] 2 Bias[\\hat{f}_D]^2 <\/span><\/span>B<\/span>ia<\/span>s<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span><\/span>2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>\uff0c\u65b9\u5dee V a r [ f ^ D ] Var[\\hat{f}_D] <\/span><\/span>Va<\/span>r<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span><\/span><\/span><\/span><\/span>\uff0c\u4ee5\u53ca\u566a\u58f0\u7684\u5e73\u65b9 \u03f5 2 \\epsilon^2 <\/span><\/span>\u03f5<\/span><\/span>2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>\u3002\u6240\u4ee5\uff0c\u5f97\u5230\u4e86\u504f\u5dee-\u65b9\u5dee\u5206\u89e3\u7684\u516c\u5f0f\uff1a<\/p>\n

          B i a s [ f ^ D ] 2 + V a r [ f ^ D ] + \u03f5 2 (8) Bias[\\hat{f}_D]^2 + Var[\\hat{f}_D] + \\epsilon^2 \\tag{8} <\/span><\/span>B<\/span>ia<\/span>s<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span><\/span>2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>+<\/span><\/span><\/span><\/span>Va<\/span>r<\/span>[<\/span><\/span>f<\/span><\/span><\/span>^<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>D<\/span><\/span><\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>]<\/span><\/span>+<\/span><\/span><\/span><\/span>\u03f5<\/span><\/span>2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>(<\/span>8<\/span><\/span>)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<\/li>\n<\/ol>\n

          \u8fd9\u5c31\u5b8c\u6210\u4e86\u504f\u5dee-\u65b9\u5dee\u5206\u89e3\u7684\u8fc7\u7a0b\uff0c\u5b83\u63ed\u793a\u4e86\u6a21\u578b\u8bef\u5dee\u7684\u4e09\u4e2a\u6765\u6e90\uff1a\u504f\u5dee\u3001\u65b9\u5dee\u548c\u566a\u58f0\u3002\u504f\u5dee\u53cd\u6620\u4e86\u6a21\u578b\u7684\u9884\u6d4b\u5e73\u5747\u503c\u4e0e\u771f\u5b9e\u503c\u4e4b\u95f4\u7684\u5dee\u5f02\uff0c\u65b9\u5dee\u53cd\u6620\u4e86\u6a21\u578b\u9884\u6d4b\u503c\u7684\u6ce2\u52a8\u6027\u6216\u79bb\u6563\u7a0b\u5ea6\uff0c\u566a\u58f0\u5219\u53cd\u6620\u4e86\u6570\u636e\u672c\u8eab\u7684\u968f\u673a\u6027\u3002\u5728\u5b9e\u9645\u7684\u6a21\u578b\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u5f80\u5f80\u9700\u8981\u5728\u504f\u5dee\u548c\u65b9\u5dee\u4e4b\u95f4\u5bfb\u627e\u4e00\u4e2a\u9002\u5f53\u7684\u5e73\u8861\uff0c\u4ee5\u8fbe\u5230\u6700\u4f4e\u7684\u9884\u6d4b\u8bef\u5dee\u3002<\/p>\n

          \u6240\u4ee5\u8bf4\uff0c\u603b\u7684\u6cdb\u5316\u8bef\u5dee\u5c31\u662f\u504f\u5dee\u3001\u65b9\u5dee\u4ee5\u53ca\u566a\u58f0\u7684\u603b\u548c\u3002\u7406\u60f3\u7684\u60c5\u51b5\u662f\uff0c\u6211\u4eec\u5e0c\u671b\u504f\u5dee\u548c\u65b9\u5dee\u90fd\u5c3d\u53ef\u80fd\u5730\u5c0f\uff0c\u4f46\u5b9e\u9645\u4e0a\u8fd9\u4e24\u8005\u5f80\u5f80\u662f\u76f8\u4e92\u77db\u76fe\u7684\uff0c\u8fd9\u5c31\u5bfc\u81f4\u4e86\u504f\u5dee-\u65b9\u5dee\u6743\u8861\uff08bias-variance tradeoff\uff09\u7684\u95ee\u9898\u3002<\/p>\n

          3.3 \u89e3\u6790<\/h4>\n

          \"\u673a\u5668\u5b66\u4e60(\u4e03)\uff1a<\/p>\n

          \u6765\u770b\u4e0b\u5177\u4f53\u60c5\u51b5\uff0c\u63cf\u8ff0\u4ece\u5750\u5230\u53f3\u5206\u522b\u5982\u4e0b\uff1a<\/p>\n

          \u4f4e\u504f\u5dee\uff0c\u4f4e\u65b9\u5dee (Low Bias, Low Variance)<\/strong>\uff1a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6a21\u578b\u7684\u9884\u6d4b\u7ed3\u679c\uff08\u84dd\u8272\u7684\u70b9\uff09\u5927\u90e8\u5206\u90fd\u975e\u5e38\u63a5\u8fd1\u771f\u5b9e\u6a21\u578b\uff08\u4e2d\u95f4\u7684\u52a0\u53f7\uff09\uff0c\u800c\u4e14\u6bcf\u6b21\u8bad\u7ec3\u5f97\u5230\u7684\u6a21\u578b\u4e4b\u95f4\u7684\u5dee\u522b\u4e5f\u975e\u5e38\u5c0f\u3002\u8fd9\u610f\u5473\u7740\uff0c\u6a21\u578b\u65e2\u80fd\u51c6\u786e\u5730\u5b66\u4e60\u5230\u6570\u636e\u7684\u771f\u5b9e\u89c4\u5f8b\uff0c\u4e5f\u5bf9\u6570\u636e\u7684\u5fae\u5c0f\u53d8\u5316\u4e0d\u654f\u611f\uff0c\u56e0\u6b64\u6a21\u578b\u7684\u9884\u6d4b\u6548\u679c\u975e\u5e38\u597d\u3002<\/p>\n

          \u9ad8\u504f\u5dee\uff0c\u4f4e\u65b9\u5dee (High Bias, Low Variance)<\/strong>\uff1a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u867d\u7136\u6bcf\u6b21\u8bad\u7ec3\u5f97\u5230\u7684\u6a21\u578b\u4e4b\u95f4\u7684\u5dee\u522b\u5f88\u5c0f\uff08\u84dd\u8272\u7684\u70b9\u975e\u5e38\u96c6\u4e2d\uff09\uff0c\u4f46\u662f\u5b83\u4eec\u79bb\u771f\u5b9e\u6a21\u578b\uff08\u4e2d\u95f4\u7684\u52a0\u53f7\uff09\u5f88\u8fdc\uff0c\u8fd9\u610f\u5473\u7740\u6a21\u578b\u5e76\u6ca1\u6709\u5f88\u597d\u5730\u5b66\u4e60\u5230\u6570\u636e\u7684\u771f\u5b9e\u89c4\u5f8b\uff0c\u5373\u6a21\u578b\u7684\u504f\u5dee\u8f83\u5927\u3002\u4f46\u662f\uff0c\u7531\u4e8e\u6a21\u578b\u7b80\u5355\uff0c\u5bf9\u6570\u636e\u7684\u5fae\u5c0f\u53d8\u5316\u4e0d\u654f\u611f\uff0c\u56e0\u6b64\u6a21\u578b\u7684\u65b9\u5dee\u8f83\u5c0f\u3002<\/p>\n

          \u4f4e\u504f\u5dee\uff0c\u9ad8\u65b9\u5dee (Low Bias, High Variance)<\/strong>\uff1a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u867d\u7136\u6a21\u578b\u7684\u9884\u6d4b\u7ed3\u679c\uff08\u84dd\u8272\u7684\u70b9\uff09\u5927\u90e8\u5206\u90fd\u975e\u5e38\u63a5\u8fd1\u771f\u5b9e\u6a21\u578b\uff08\u4e2d\u95f4\u7684\u52a0\u53f7\uff09\uff0c\u4f46\u662f\u6bcf\u6b21\u8bad\u7ec3\u5f97\u5230\u7684\u6a21\u578b\u4e4b\u95f4\u7684\u5dee\u522b\u8f83\u5927\u3002\u8fd9\u610f\u5473\u7740\uff0c\u6a21\u578b\u80fd\u51c6\u786e\u5730\u5b66\u4e60\u5230\u6570\u636e\u7684\u771f\u5b9e\u89c4\u5f8b\uff0c\u4f46\u5bf9\u6570\u636e\u7684\u5fae\u5c0f\u53d8\u5316\u8fc7\u4e8e\u654f\u611f\uff0c\u5bfc\u81f4\u6a21\u578b\u7684\u7a33\u5b9a\u6027\u8f83\u5dee\uff0c\u5373\u6a21\u578b\u7684\u65b9\u5dee\u8f83\u5927\u3002<\/p>\n

          \u9ad8\u504f\u5dee\uff0c\u9ad8\u65b9\u5dee (High Bias, High Variance)<\/strong>\uff1a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6a21\u578b\u7684\u9884\u6d4b\u7ed3\u679c\uff08\u84dd\u8272\u7684\u70b9\uff09\u65e2\u8fdc\u79bb\u771f\u5b9e\u6a21\u578b\uff08\u4e2d\u95f4\u7684\u52a0\u53f7\uff09\uff0c\u540c\u65f6\u6bcf\u6b21\u8bad\u7ec3\u5f97\u5230\u7684\u6a21\u578b\u4e4b\u95f4\u7684\u5dee\u522b\u4e5f\u5f88\u5927\u3002\u8fd9\u610f\u5473\u7740\uff0c\u6a21\u578b\u65e2\u6ca1\u6709\u5f88\u597d\u5730\u5b66\u4e60\u5230\u6570\u636e\u7684\u771f\u5b9e\u89c4\u5f8b\uff0c\u53c8\u5bf9\u6570\u636e\u7684\u5fae\u5c0f\u53d8\u5316\u8fc7\u4e8e\u654f\u611f\uff0c\u8fd9\u79cd\u60c5\u51b5\u662f\u6211\u4eec\u6700\u4e0d\u5e0c\u671b\u770b\u5230\u7684\u3002<\/p>\n

          \u6211\u4eec\u7684\u76ee\u6807\u662f\u8ba9\u6a21\u578b\u65e2\u6709\u4f4e\u504f\u5dee\uff0c\u53c8\u6709\u4f4e\u65b9\u5dee\uff0c\u8fd9\u6837\u7684\u6a21\u578b\u9884\u6d4b\u6548\u679c\u624d\u4f1a\u6700\u597d\u3002\u5f53\u9047\u5230\u5176\u4ed6\u4e09\u79cd\u60c5\u51b5\u65f6\uff0c\u5c31\u9700\u8981\u901a\u8fc7\u8c03\u6574\u6a21\u578b\u590d\u6742\u5ea6\u3001\u589e\u52a0\u8bad\u7ec3\u6570\u636e\u91cf\u3001\u4f7f\u7528\u6b63\u5219\u5316\u7b49\u65b9\u6cd5\uff0c\u6765\u5c3d\u53ef\u80fd\u5730\u964d\u4f4e\u6a21\u578b\u7684\u504f\u5dee\u548c\u65b9\u5dee\u3002<\/p>\n

          \u6700\u540e\uff0c\u611f\u8c22\u60a8\u9605\u8bfb\u8fd9\u7bc7\u6587\u7ae0\uff01\u5982\u679c\u60a8\u89c9\u5f97\u6709\u6240\u6536\u83b7\uff0c\u522b\u5fd8\u4e86\u70b9\u8d5e\u3001\u6536\u85cf\u5e76\u5173\u6ce8\u6211\uff0c\u8fd9\u662f\u6211\u6301\u7eed\u521b\u4f5c\u7684\u52a8\u529b\u3002\u60a8\u6709\u4efb\u4f55\u95ee\u9898\u6216\u5efa\u8bae\uff0c\u90fd\u53ef\u4ee5\u5728\u8bc4\u8bba\u533a\u7559\u8a00\uff0c\u6211\u4f1a\u5c3d\u529b\u56de\u7b54\u5e76\u63a5\u53d7\u60a8\u7684\u53cd\u9988\u3002\u5982\u679c\u60a8\u5e0c\u671b\u4e86\u89e3\u67d0\u4e2a\u7279\u5b9a\u4e3b\u9898\uff0c\u4e5f\u6b22\u8fce\u544a\u8bc9\u6211\uff0c\u6211\u4f1a\u4e50\u4e8e\u521b\u4f5c\u4e0e\u4e4b\u76f8\u5173\u7684\u6587\u7ae0\u3002\u8c22\u8c22\u60a8\u7684\u652f\u6301\uff0c\u671f\u5f85\u4e0e\u60a8\u5171\u540c\u6210\u957f\uff01<\/p>\n

          \u671f\u5f85\u4e0e\u60a8\u5728\u672a\u6765\u7684\u5b66\u4e60\u4e2d\u5171\u540c\u6210\u957f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u673a\u5668\u5b66\u4e60(\u4e03)\uff1a Bias\u3001Error\u548cVariance\u7684\u533a\u522b\u4e0e\u8054\u7cfb\u8fd9\u7bc7\u6587\u7ae0\u9996\u5148\u4ecb\u7ecd\u4e86\u57fa\u7840\u6982\u5ff5\uff0c\u5305\u62ec\u504f\u5dee\uff08Bias\uff09\u3001\u65b9\u5dee\uff08Variance\uff09\u548c\u8bef\u5dee...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/9094"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=9094"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/9094\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=9094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=9094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=9094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}