{"id":345,"date":"2025-02-13T22:49:38","date_gmt":"2025-02-13T14:49:38","guid":{"rendered":"http:\/\/www.loyeh.top\/?p=345"},"modified":"2025-02-13T22:49:38","modified_gmt":"2025-02-13T14:49:38","slug":"dropout","status":"publish","type":"post","link":"https:\/\/loyeh.top\/index.php\/2025\/02\/13\/dropout\/","title":{"rendered":"Dropout"},"content":{"rendered":"\n<p>Dropout \u662f\u4e00\u79cd\u7528\u4e8e\u9632\u6b62\u795e\u7ecf\u7f51\u7edc\u8fc7\u62df\u5408\u7684\u6b63\u5219\u5316\u6280\u672f\uff0c\u7531 Geoffrey Hinton \u7b49\u4eba\u5728 2012 \u5e74\u63d0\u51fa\u3002\u5b83\u901a\u8fc7\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u968f\u673a\u201c\u4e22\u5f03\u201d\u4e00\u90e8\u5206\u795e\u7ecf\u5143\uff0c\u51cf\u5c11\u795e\u7ecf\u5143\u4e4b\u95f4\u7684\u590d\u6742\u5171\u9002\u5e94\u5173\u7cfb\uff0c\u4ece\u800c\u63d0\u9ad8\u6a21\u578b\u7684\u6cdb\u5316\u80fd\u529b\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1.\u7b80\u4ecb<\/h2>\n\n\n\n<p><strong>Dropout \u7684\u6838\u5fc3\u601d\u60f3<\/strong>\uff1a\u5728\u6bcf\u6b21\u8bad\u7ec3\u8fed\u4ee3\u4e2d\uff0c\u968f\u673a\u201c\u5173\u95ed\u201d\u7f51\u7edc\u4e2d\u7684\u4e00\u90e8\u5206\u795e\u7ecf\u5143\uff08\u5373\u5c06\u5176\u8f93\u51fa\u8bbe\u4e3a 0\uff09\uff0c\u4f7f\u5f97\u6bcf\u6b21\u8bad\u7ec3\u65f6\u7f51\u7edc\u7ed3\u6784\u90fd\u4e0d\u540c\u3002\u8fd9\u6837\u53ef\u4ee5\u9632\u6b62\u795e\u7ecf\u5143\u8fc7\u5ea6\u4f9d\u8d56\u67d0\u4e9b\u7279\u5b9a\u7684\u795e\u7ecf\u5143\uff0c\u4ece\u800c\u589e\u5f3a\u6a21\u578b\u7684\u9c81\u68d2\u6027\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u4e22\u5f03\u6982\u7387\uff08Dropout Rate\uff09<\/strong>\uff1a\u901a\u5e38\u7528 $p$ \u8868\u793a\uff0c\u8868\u793a\u6bcf\u4e2a\u795e\u7ecf\u5143\u88ab\u4e22\u5f03\u7684\u6982\u7387\u3002\u4f8b\u5982\uff0cp = 0.5 \u8868\u793a\u6bcf\u4e2a\u795e\u7ecf\u5143\u6709 50% \u7684\u6982\u7387\u88ab\u4e22\u5f03\u3002<\/li>\n\n\n\n<li><strong>\u4fdd\u7559\u6982\u7387<\/strong>\uff1a$ 1 - p $\uff0c\u8868\u793a\u795e\u7ecf\u5143\u88ab\u4fdd\u7559\u7684\u6982\u7387\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2.\u5de5\u4f5c\u539f\u7406<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bad\u7ec3\u9636\u6bb5\uff1a<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5bf9\u4e8e\u6bcf\u4e00\u5c42\u795e\u7ecf\u5143\uff0c\u4ee5\u6982\u7387 p \u968f\u673a\u4e22\u5f03\u90e8\u5206\u795e\u7ecf\u5143\uff08\u5c06\u5176\u8f93\u51fa\u8bbe\u4e3a 0\uff09\u3002<\/li>\n\n\n\n<li>\u4fdd\u7559\u7684\u795e\u7ecf\u5143\u7684\u8f93\u51fa\u4f1a\u88ab\u653e\u5927 $ \\frac{1}{1-p} $\u500d\uff0c\u4ee5\u4fdd\u6301\u8bad\u7ec3\u548c\u6d4b\u8bd5\u65f6\u8f93\u51fa\u7684\u671f\u671b\u503c\u4e00\u81f4\u3002<\/li>\n\n\n\n<li>\u6bcf\u6b21\u8bad\u7ec3\u8fed\u4ee3\u90fd\u4f1a\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u201c\u5b50\u7f51\u7edc\u201d\uff0c\u56e0\u4e3a\u4e22\u5f03\u7684\u795e\u7ecf\u5143\u662f\u968f\u673a\u7684\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u6d4b\u8bd5\u9636\u6bb5\uff1a<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u4e0d\u4f7f\u7528 Dropout\uff0c\u6240\u6709\u795e\u7ecf\u5143\u90fd\u53c2\u4e0e\u8ba1\u7b97\u3002<\/li>\n\n\n\n<li>\u4e3a\u4e86\u4fdd\u6301\u8f93\u51fa\u7684\u4e00\u81f4\u6027\uff0c\u6bcf\u4e2a\u795e\u7ecf\u5143\u7684\u8f93\u51fa\u9700\u8981\u4e58\u4ee5\u4fdd\u7559\u6982\u7387 1-p\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u6570\u5b66\u8868\u8fbe\uff1a<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8bad\u7ec3\u65f6\uff1a$ y = x \\cdot m \\cdot \\frac{1}{1-p} $\uff0cx \u662f\u8f93\u5165\uff0cm\u662f\u4e00\u4e2a\u4e8c\u503c\u63a9\u7801\uff080 \u6216 1\uff09\uff0c$ \\frac{1}{1-p} $ \u662f\u7f29\u653e\u56e0\u5b50\u3002<\/li>\n\n\n\n<li>\u6d4b\u8bd5\u65f6\uff1a$ y = x \\cdot (1-p) $\uff0c\u76f4\u63a5\u5bf9\u8f93\u51fa\u8fdb\u884c\u7f29\u653e\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">3.\u4f5c\u7528<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u9632\u6b62\u8fc7\u62df\u5408<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>Dropout \u901a\u8fc7\u968f\u673a\u4e22\u5f03\u795e\u7ecf\u5143\uff0c\u51cf\u5c11\u4e86\u795e\u7ecf\u5143\u4e4b\u95f4\u7684\u590d\u6742\u4f9d\u8d56\u5173\u7cfb\uff0c\u4f7f\u5f97\u7f51\u7edc\u4e0d\u80fd\u8fc7\u5ea6\u4f9d\u8d56\u67d0\u4e9b\u7279\u5b9a\u7684\u795e\u7ecf\u5143\u3002\u8fd9\u76f8\u5f53\u4e8e\u8bad\u7ec3\u4e86\u591a\u4e2a\u4e0d\u540c\u7684\u5b50\u7f51\u7edc\uff0c\u5e76\u5728\u6d4b\u8bd5\u65f6\u5bf9\u8fd9\u4e9b\u5b50\u7f51\u7edc\u8fdb\u884c\u5e73\u5747\uff0c\u4ece\u800c\u63d0\u9ad8\u4e86\u6cdb\u5316\u80fd\u529b\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u589e\u5f3a\u9c81\u68d2\u6027<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>\u7531\u4e8e\u6bcf\u6b21\u8bad\u7ec3\u65f6\u7f51\u7edc\u7ed3\u6784\u90fd\u4e0d\u540c\uff0c\u6a21\u578b\u5bf9\u8f93\u5165\u7684\u5fae\u5c0f\u53d8\u5316\u66f4\u52a0\u9c81\u68d2\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u7c7b\u4f3c\u4e8e\u6a21\u578b\u96c6\u6210<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>Dropout \u53ef\u4ee5\u88ab\u770b\u4f5c\u662f\u4e00\u79cd\u9690\u5f0f\u7684\u6a21\u578b\u96c6\u6210\u65b9\u6cd5\uff0c\u56e0\u4e3a\u6bcf\u6b21\u8bad\u7ec3\u65f6\u90fd\u5728\u8bad\u7ec3\u4e0d\u540c\u7684\u5b50\u7f51\u7edc\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">4. \u5b9e\u73b0<\/h2>\n\n\n\n<p>\u5728\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\u4e2d\uff0cDropout \u7684\u5b9e\u73b0\u975e\u5e38\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5728 PyTorch \u4e2d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import torch\nimport torch.nn as nn\n\n# \u5b9a\u4e49\u4e00\u4e2a\u5e26\u6709 Dropout \u7684\u7f51\u7edc\nclass Net(nn.Module):\n    def __init__(self):\n        super(Net, self).__init__()\n        self.fc1 = nn.Linear(784, 256)\n        self.dropout = nn.Dropout(p=0.5)  # Dropout \u5c42\uff0c\u4e22\u5f03\u6982\u7387\u4e3a 0.5\n        self.fc2 = nn.Linear(256, 10)\n\n    def forward(self, x):\n        x = torch.relu(self.fc1(x))\n        x = self.dropout(x)  # \u5728\u8bad\u7ec3\u65f6\u5e94\u7528 Dropout\n        x = self.fc2(x)\n        return x\n\n# \u8bad\u7ec3\u65f6\uff0cDropout \u4f1a\u81ea\u52a8\u751f\u6548\uff1b\u6d4b\u8bd5\u65f6\uff0cDropout \u4f1a\u81ea\u52a8\u5173\u95ed<\/code><\/pre>\n\n\n\n<p>\u5728 TensorFlow \u4e2d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import tensorflow as tf\n\n# \u5b9a\u4e49\u4e00\u4e2a\u5e26\u6709 Dropout \u7684\u7f51\u7edc\nmodel = tf.keras.Sequential(&#91;\n    tf.keras.layers.Dense(256, activation='relu', input_shape=(784,)),\n    tf.keras.layers.Dropout(0.5),  # Dropout \u5c42\uff0c\u4e22\u5f03\u6982\u7387\u4e3a 0.5\n    tf.keras.layers.Dense(10)\n])\n\n# \u8bad\u7ec3\u65f6\uff0cDropout \u4f1a\u81ea\u52a8\u751f\u6548\uff1b\u6d4b\u8bd5\u65f6\uff0cDropout \u4f1a\u81ea\u52a8\u5173\u95ed<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u6ce8\u610f\u4e8b\u9879<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u4e22\u5f03\u6982\u7387\u7684\u9009\u62e9<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>\u901a\u5e38 p = 0.5 \u662f\u4e00\u4e2a\u5e38\u7528\u7684\u9ed8\u8ba4\u503c\uff0c\u4f46\u5177\u4f53\u503c\u9700\u8981\u6839\u636e\u4efb\u52a1\u548c\u7f51\u7edc\u7ed3\u6784\u8fdb\u884c\u8c03\u6574\u3002<\/li>\n\n\n\n<li>\u5bf9\u4e8e\u8f83\u5927\u7684\u7f51\u7edc\uff0c\u53ef\u4ee5\u9002\u5f53\u589e\u52a0 p\uff1b\u5bf9\u4e8e\u8f83\u5c0f\u7684\u7f51\u7edc\uff0c\u53ef\u4ee5\u9002\u5f53\u51cf\u5c0f p\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Dropout \u7684\u4f4d\u7f6e<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>Dropout \u901a\u5e38\u5e94\u7528\u5728\u5168\u8fde\u63a5\u5c42\u4e4b\u540e\uff0c\u4f46\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u4e5f\u53ef\u4ee5\u5e94\u7528\u5728\u5377\u79ef\u5c42\u4e4b\u540e\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Batch Normalization \u548c Dropout \u7684\u7ed3\u5408<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>\u5728\u4f7f\u7528 Batch Normalization \u65f6\uff0cDropout \u7684\u6548\u679c\u53ef\u80fd\u4f1a\u51cf\u5f31\uff0c\u56e0\u4e3a Batch Normalization \u672c\u8eab\u4e5f\u6709\u6b63\u5219\u5316\u4f5c\u7528\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u540c\u65f6\u4f7f\u7528\u4e24\u8005\uff0c\u9700\u8981\u4ed4\u7ec6\u8c03\u6574\u8d85\u53c2\u6570\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u6d4b\u8bd5\u65f6\u7684\u7f29\u653e<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>\u5728\u6d4b\u8bd5\u65f6\uff0cDropout \u5c42\u9700\u8981\u5173\u95ed\uff0c\u5e76\u4e14\u5bf9\u8f93\u51fa\u8fdb\u884c\u7f29\u653e\uff08\u4e58\u4ee5 1-p \uff09\uff0c\u4ee5\u4fdd\u6301\u8bad\u7ec3\u548c\u6d4b\u8bd5\u65f6\u8f93\u51fa\u7684\u4e00\u81f4\u6027\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">6. \u53d8\u4f53<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Spatial Dropout<\/strong>\uff1a\u9002\u7528\u4e8e\u5377\u79ef\u5c42\uff0c\u4e22\u5f03\u7684\u662f\u6574\u4e2a\u7279\u5f81\u56fe\uff08channel\uff09\uff0c\u800c\u4e0d\u662f\u5355\u4e2a\u795e\u7ecf\u5143\u3002<\/li>\n\n\n\n<li><strong>DropConnect<\/strong>\uff1a\u4e0e Dropout \u7c7b\u4f3c\uff0c\u4f46\u4e22\u5f03\u7684\u662f\u6743\u91cd\uff08weights\uff09\uff0c\u800c\u4e0d\u662f\u795e\u7ecf\u5143\u3002<\/li>\n\n\n\n<li><strong>Adaptive Dropout<\/strong>\uff1a\u6839\u636e\u795e\u7ecf\u5143\u7684\u91cd\u8981\u6027\u52a8\u6001\u8c03\u6574\u4e22\u5f03\u6982\u7387\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">7. \u5c40\u9650\u6027<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u8bad\u7ec3\u65f6\u95f4\u589e\u52a0<\/strong>\uff1a\u7531\u4e8e\u6bcf\u6b21\u8bad\u7ec3\u65f6\u7f51\u7edc\u7ed3\u6784\u90fd\u4e0d\u540c\uff0c\u8bad\u7ec3\u65f6\u95f4\u53ef\u80fd\u4f1a\u589e\u52a0\u3002<\/li>\n\n\n\n<li><strong>\u4e0d\u9002\u7528\u4e8e\u6240\u6709\u4efb\u52a1<\/strong>\uff1a\u5728\u67d0\u4e9b\u4efb\u52a1\u4e2d\uff08\u5982\u5c0f\u6570\u636e\u96c6\u6216\u7b80\u5355\u6a21\u578b\uff09\uff0cDropout \u7684\u6548\u679c\u53ef\u80fd\u4e0d\u660e\u663e\uff0c\u751a\u81f3\u53ef\u80fd\u964d\u4f4e\u6027\u80fd\u3002<\/li>\n\n\n\n<li><strong>\u4e0e Batch Normalization \u7684\u51b2\u7a81<\/strong>\uff1a\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0cDropout \u548c Batch Normalization \u7684\u7ed3\u5408\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u603b\u7ed3<\/h2>\n\n\n\n<p>Dropout \u662f\u4e00\u79cd\u7b80\u5355\u4f46\u975e\u5e38\u6709\u6548\u7684\u6b63\u5219\u5316\u6280\u672f\uff0c\u901a\u8fc7\u968f\u673a\u4e22\u5f03\u795e\u7ecf\u5143\u6765\u9632\u6b62\u8fc7\u62df\u5408\uff0c\u589e\u5f3a\u6a21\u578b\u7684\u6cdb\u5316\u80fd\u529b\u3002\u5b83\u5728\u6df1\u5ea6\u5b66\u4e60\u4e2d\u5e7f\u6cdb\u5e94\u7528\uff0c\u5c24\u5176\u662f\u5728\u5168\u8fde\u63a5\u5c42\u4e2d\u3002\u7136\u800c\uff0c\u4f7f\u7528\u65f6\u9700\u8981\u6ce8\u610f\u4e22\u5f03\u6982\u7387\u7684\u9009\u62e9\u3001\u4e0e\u5176\u4ed6\u6b63\u5219\u5316\u65b9\u6cd5\u7684\u7ed3\u5408\u4ee5\u53ca\u6d4b\u8bd5\u65f6\u7684\u7f29\u653e\u95ee\u9898\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u53c2\u8003\u6587\u7ae0<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/blog.csdn.net\/weixin_42475060\/article\/details\/128862411\" target=\"_blank\"  rel=\"nofollow\" >Dropout\u7684\u6df1\u5165\u7406\u89e3\uff08\u57fa\u7840\u4ecb\u7ecd\u3001\u6a21\u578b\u63cf\u8ff0\u3001\u539f\u7406\u6df1\u5165\u3001\u4ee3\u7801\u5b9e\u73b0\u4ee5\u53ca\u53d8\u79cd\uff09-CSDN\u535a\u5ba2<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.bbbdata.com\/text\/844\" target=\"_blank\"  rel=\"nofollow\" >\u4e00\u7bc7\u5165\u95e8\u4e4b-Dropout\u7684\u539f\u7406\u4e0e\u5b9e\u73b0\u8be6\u8ff0\uff08\u56fe\u89e3+\u4ee3\u7801\uff09-\u8001\u997c\u8bb2\u89e3<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/blog.csdn.net\/y1679894291\/article\/details\/145558171\" target=\"_blank\"  rel=\"nofollow\" >Dropout \u5c42\u8d85\u8be6\u7ec6\u89e3\u6790-CSDN\u535a\u5ba2<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Dropout \u662f\u4e00\u79cd\u7528\u4e8e\u9632\u6b62\u795e\u7ecf\u7f51\u7edc\u8fc7\u62df\u5408\u7684\u6b63\u5219\u5316\u6280\u672f\uff0c\u7531 Geoffrey Hinton \u7b49\u4eba\u5728 2012 \u5e74\u63d0\u51fa\u3002\u5b83\u901a\u8fc7\u5728\u8bad &#8230;<\/p>","protected":false},"author":1,"featured_media":361,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-345","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-22"],"jetpack_featured_media_url":"https:\/\/loyeh.top\/wp-content\/uploads\/2025\/02\/dropout.png","_links":{"self":[{"href":"https:\/\/loyeh.top\/index.php\/wp-json\/wp\/v2\/posts\/345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/loyeh.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/loyeh.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/loyeh.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/loyeh.top\/index.php\/wp-json\/wp\/v2\/comments?post=345"}],"version-history":[{"count":15,"href":"https:\/\/loyeh.top\/index.php\/wp-json\/wp\/v2\/posts\/345\/revisions"}],"predecessor-version":[{"id":360,"href":"https:\/\/loyeh.top\/index.php\/wp-json\/wp\/v2\/posts\/345\/revisions\/360"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/loyeh.top\/index.php\/wp-json\/wp\/v2\/media\/361"}],"wp:attachment":[{"href":"https:\/\/loyeh.top\/index.php\/wp-json\/wp\/v2\/media?parent=345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/loyeh.top\/index.php\/wp-json\/wp\/v2\/categories?post=345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/loyeh.top\/index.php\/wp-json\/wp\/v2\/tags?post=345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}