{"id":2273,"date":"2024-10-10T17:06:33","date_gmt":"2024-10-10T09:06:33","guid":{"rendered":"https:\/\/www.gnn.club\/?p=2273"},"modified":"2024-10-10T17:10:07","modified_gmt":"2024-10-10T09:10:07","slug":"graph-sample-and-aggregate-network%ef%bc%88graphsage%ef%bc%89","status":"publish","type":"post","link":"http:\/\/www.gnn.club\/?p=2273","title":{"rendered":"Graph Sample and Aggregate Network\uff08GraphSAGE\uff09"},"content":{"rendered":"\n<p>\u76f8\u6bd4GCN\uff0cGraphSAGE\u53ef\u4ee5\u5904\u7406Inductive\u7c7b\u578b\u7684\u4efb\u52a1\u3002Inductive\u4efb\u52a1\u7684\u5173\u952e\u5728\u4e8e\u8bbe\u8ba1\u80fd\u591f\u826f\u597d\u6cdb\u5316\u5230\u672a\u89c1\u8fc7\u7684\u56fe\u6216\u8282\u70b9\u4e0a\u7684\u6a21\u578b\u3002\u5176\u6311\u6218\u5728\u4e8e\u6a21\u578b\u9700\u8981\u80fd\u591f\u5904\u7406\u56fe\u7684\u7ed3\u6784\u548c\u7279\u5f81\u5728\u8bad\u7ec3\u96c6\u548c\u6d4b\u8bd5\u96c6\u4e4b\u95f4\u53ef\u80fd\u6709\u663e\u8457\u5dee\u5f02\u7684\u60c5\u51b5\u3002\u56e0\u6b64\uff0c\u9002\u7528\u4e8eInductive\u4efb\u52a1\u7684GNN\u6a21\u578b\u5728\u8bbe\u8ba1\u65f6\uff0c\u5e94\u8be5\u4fa7\u91cd\u4e8e\u5b66\u4e60\u80fd\u591f\u4ee3\u8868\u5355\u4e2a\u8282\u70b9\u7684\u901a\u7528\u8868\u793a\uff0c\u800c\u4e0d\u662f\u4f9d\u8d56\u4e8e\u6574\u4e2a\u56fe\u7684\u7ed3\u6784\u3002\u8fd9\u610f\u5473\u7740\u6a21\u578b\u5e94\u8be5\u80fd\u591f\u4ece\u8282\u70b9\u7684\u5c40\u90e8\u90bb\u57df\u4fe1\u606f\u4e2d\u5b66\u4e60\u5176\u8868\u793a\uff0c\u800c\u4e0d\u662f\u4ece\u6574\u4e2a\u56fe\u7684\u5168\u5c40\u7ed3\u6784\u4e2d\u5b66\u4e60\uff0cGCN\u5229\u7528\u6574\u4e2a\u90bb\u63a5\u77e9\u9635\u8fd9\u4e00\u505a\u6cd5\u5c31\u8fdd\u53cd\u4e86\u8fd9\u4e00\u70b9\u3002GraphSAGE\u5bf9\u6b64\u5219\u8fdb\u884c\u4e86\u6539\u8fdb\uff0c\u66f4\u65b0\u8282\u70b9\u4fe1\u606f\u7684\u65b9\u5f0f\u5c31\u4e0d\u4f9d\u8d56\u4e8e\u56fe\u7684\u5168\u5c40\u7ed3\u6784\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5176\u66f4\u65b0\u8fc7\u7a0b\u4e3b\u8981\u5206\u4e09\u6b65\uff1a<\/p>\n\n\n\n<p>\uff081\uff09\u805a\u5408\u90bb\u5c45\u8282\u70b9\u7684\u4fe1\u606f\uff0c\u805a\u5408\u51fd\u6570\u6709\u4e09\u79cd\uff0c\u5c06\u5728\u4e0b\u6587\u5c55\u5f00\u89e3\u91ca\uff1b<\/p>\n\n\n\n<p>\uff082\uff09\u5c06\u805a\u5408\u540e\u7684\u4fe1\u606f\u4e0e\u81ea\u8eab\u7684\u8282\u70b9\u4fe1\u606f\u8fdb\u884c\u62fc\u63a5\uff0c\u8fdb\u884c\u7279\u5f81\u7684\u878d\u5408\uff1b<\/p>\n\n\n\n<p>\uff083\uff09\u9001\u5165\u795e\u7ecf\u7f51\u7edc\u6a21\u578b\u4e2d\u8fdb\u884c\u6620\u5c04\uff0c\u5f97\u5230\u66f4\u65b0\u540e\u7684\u8282\u70b9\u4fe1\u606f\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff1a\u56fe\u6570\u636e\u5982\u56fe1\u6240\u793a\uff0c\u73b0\u5728\u4f7f\u7528GraphSAGE\u5bf9\u8282\u70b91\u8fdb\u884c\u66f4\u65b0\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"687\" height=\"451\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/10\/20241010155040611.png\" alt=\"\" class=\"wp-image-2274\" srcset=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/10\/20241010155040611.png 687w, https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/10\/20241010155040611-300x197.png 300w\" sizes=\"auto, (max-width: 687px) 100vw, 687px\" \/><figcaption class=\"wp-element-caption\">\u56fe1 \u56fe\u6570\u636e<\/figcaption><\/figure><\/div>\n\n\n<p>\u8282\u70b91\u7279\u5f81\u5411\u91cf\u7684\u66f4\u65b0\u6b65\u9aa4\u5982\u4e0b\u4e09\u6b65\uff1a<\/p>\n\n\n\n<p>\uff081\uff09\u805a\u5408\u90bb\u5c45\u8282\u70b9\uff1a\\(h_{\\mathcal{N}(1)}^1\\leftarrow\\mathrm{AGGREGATE}(h_3^0,h_4^0,h_5^0,h_6^0)\\)<\/p>\n\n\n\n<p>\uff082\uff09\u62fc\u63a5\u81ea\u8eab\u4fe1\u606f\uff1a\\(h_1^1\\leftarrow\\mathrm{CONCAT}(h_1^0,h_{\\mathcal N(1)}^0)\\)<\/p>\n\n\n\n<p>\uff083\uff09\u7ecf\u8fc7\u795e\u7ecf\u7f51\u7edc\u6620\u5c04\uff1a\\(h_1^1\\leftarrow\\sigma(W^1\\cdot\\mathrm{CONCAT}(h_1^0,h_{N(1)}^0))\\)<\/p>\n\n\n\n<p>\u5047\u8bbe\u6b65\u9aa41\u4e2d\u805a\u5408\u51fd\u6570AGGREGATE\u662fMean\u51fd\u6570\uff0c\u5219\u4ee3\u6570\u5f97\uff1a<\/p>\n\n\n<p style=\"text-align: center;\">\\(h_{N(1)}^1\\leftarrow\\mathrm{AGGREGATE}(h_3^0,h_4^0,h_5^0,h_6^0)=\\mathrm{Mean}([0.3,0.4],[0.2,0.2],[0.7,0.8],[0.5,0.6])\\)<\/p>\n\n\n<p>\u53e6\u5916\uff0c\u5728\u8fd9\u4e2a\u8ba1\u7b97\u6d41\u7a0b\u4e2d\u6709\u4e24\u4e2a\u5730\u65b9\u9700\u8981\u989d\u5916\u6ce8\u610f\u3002\u7b2c\u4e00\uff0cGraphSAGE\u5728\u805a\u5408\u67d0\u8282\u70b9\u90bb\u5c45\u4fe1\u606f\u7684\u65f6\u5019\uff0c\u5e76\u4e0d\u662f\u805a\u5408\u5168\u90e8\u7684\u90bb\u5c45\uff0c\u800c\u662f\u805a\u5408<em>K<\/em>\u4e2a\u90bb\u5c45\uff0c<em>K<\/em>\u662f\u4e00\u4e2a\u8d85\u53c2\u6570\u3002\u4e3e\u4f8b\uff0c\u5728\u56fe1\u4e2d\uff0c\u82e5<em>K<\/em>\u7b49\u4e8e3\uff0c\u5219\u5728\u805a\u5408\u8282\u70b91\u7684\u5468\u56f4\u90bb\u5c45\u65f6\uff0c\u968f\u673a\u4ece\u8282\u70b93\u30014\u30015\u30016\u4e2d\u9009\u62e93\u4e2a\u8fdb\u884c\u805a\u5408\u3002\u82e5<em>K<\/em>\u7b49\u4e8e5\uff0c\u5219\u9664\u4e86\u9009\u62e9\u8282\u70b91\u7684\u5468\u56f44\u4e2a\u90bb\u5c45\u4ee5\u5916\uff0c\u518d\u91cd\u590d\u4ece\u8fd94\u4e2a\u90bb\u5c45\u4e2d\u62bd\u6837\u4e00\u4e2a\u8282\u70b9\u3002\u8fd9\u6837\u505a\u7684\u597d\u5904\u662f\uff0c\u5f53\u56fe\u6570\u636e\u975e\u5e38\u5e9e\u5927\u65f6\uff0c\u9009\u53d6\u67d0\u8282\u70b9\u7684\u5168\u90e8\u90bb\u5c45\u505a\u805a\u5408\u662f\u975e\u5e38\u8017\u65f6\u8017\u529b\u7684\uff0c\u82e5\u53ea\u9009\u62e9\u5176\u4e2d\u7684<em>K<\/em>\u4e2a\u90bb\u5c45\uff0c\u53ef\u4ee5\u66f4\u5feb\u7684\u8fdb\u884c\u8ba1\u7b97\u3002\u8d85\u53c2\u6570<em>K<\/em>\u672c\u8d28\u4e0a\u662f\u8ba1\u7b97\u7cbe\u5ea6\u548c\u8ba1\u7b97\u901f\u5ea6\u4e4b\u95f4\u7684\u4e00\u79cd\u6743\u8861\u3002<\/p>\n\n\n\n<p>\u7b2c\u4e8c\u4e2a\u9700\u8981\u6ce8\u610f\u7684\u662fGraphSAGE\u5b9a\u4e49\u4e86\u4e09\u79cd\u4e0d\u540c\u7684\u805a\u5408\u51fd\u6570\uff1a<\/p>\n\n\n<p style=\"text-align: center;\">\\(\\begin{aligned}&amp;(1) \\mathrm{Mean:}\\quad AGG=\\sum_{u\\in N(\\nu)}\\frac{h_{u}^{(l)}}{\\mid N(\\nu)\\mid} \\leftarrow\\\\&amp;(2) \\mathrm{Pool:}\\quad A GG=\\gamma\\left(\\{\\mathrm{MLP}(h_{u}^{(l)}),\\forall u\\in N(\\nu)\\}\\right) \\leftarrow\\\\&amp;(3) \\mathrm{LSTM:}\\quad A GG=\\mathrm{LSTM}\\left([h_{u}^{(l)},\\forall u\\in\\pi\\left(N(\\nu)\\right)]\\right) \\leftarrow\\end{aligned}\\)<\/p>\n\n\n<p>Mean\u64cd\u4f5c\u5c31\u662f\u7b80\u5355\u7684\u5bf9\u8282\u70b9\u7684\u90bb\u5c45\u4fe1\u606f\u505a\u5e73\u5747\uff0c\u4e0a\u6587\u4e5f\u505a\u8fc7\u4e3e\u4f8b\u8bf4\u660e\u3002Pool\u64cd\u4f5c\u5c31\u662f\u5148\u628a\u8282\u70b9\u7684\u90bb\u5c45\u8282\u70b9\u5411\u91cf\u9001\u5165\u4e00\u4e2aMLP\u4e2d\uff0c\u5bf9MLP\u7684\u8f93\u51fa\u7ed3\u679c\u505a\\gamma\u64cd\u4f5c\u5f97\u5230\u805a\u5408\u540e\u7684\u8282\u70b9\u5411\u91cf\uff0c\u8fd9\u4e2a\\gamma\u5c31\u662f\u6c60\u5316\u7684\u7b97\u5b50\uff0c\u53ef\u4ee5\u662fMean\uff0c\u4e5f\u53ef\u4ee5\u662fMax\uff0c\u5206\u522b\u5bf9\u5e94\u5e73\u5747\u6c60\u5316\u548c\u6700\u5927\u6c60\u5316\uff0c\u5b83\u4eec\u7684\u5b9e\u9645\u4f7f\u7528\u6548\u679c\u90fd\u5dee\u4e0d\u591a\u3002\u81f3\u4e8e\u7b2c\u4e09\u79cdLSTM\u7684\u805a\u5408\u65b9\u5f0f\u4e0e\u7b2c\u4e8c\u79cdPool\u805a\u5408\u7c7b\u4f3c\uff0c\u533a\u522b\u5728\u4e8e\u628aMLP\u6362\u6210\u4e86LSTM\u6a21\u578b\u3002LSTM\u6a21\u578b\u7684\u7279\u5f81\u662f\u80fd\u591f\u5bf9\u5e8f\u5217\u4fe1\u606f\u8fdb\u884c\u66f4\u597d\u7684\u5efa\u6a21\uff0c\u901a\u8fc7\u7ef4\u62a4\u4e00\u4e2a\u5185\u90e8\u72b6\u6001\uff08\u8bb0\u5fc6\u5355\u5143\uff09\u6765\u6355\u6349\u5e8f\u5217\u4e2d\u7684\u987a\u5e8f\u4f9d\u8d56\u6027\u3002\u5728\u56fe\u7ed3\u6784\u4e2d\uff0c\u8fd9\u610f\u5473\u7740\u5982\u679c\u8282\u70b9\u7684\u8fde\u63a5\u5177\u6709\u67d0\u79cd\u903b\u8f91\u6216\u65f6\u95f4\u987a\u5e8f\uff0cLSTM\u53ef\u80fd\u80fd\u66f4\u597d\u5730\u5229\u7528\u8fd9\u79cd\u4fe1\u606f\u3002\u800c\u4e14\uff0cLSTM\u80fd\u591f\u6839\u636e\u5e8f\u5217\u4e2d\u6bcf\u4e2a\u5143\u7d20\u7684\u91cd\u8981\u6027\u52a8\u6001\u8c03\u6574\u5176\u5185\u90e8\u72b6\u6001\uff0c\u8fd9\u5141\u8bb8\u5b83\u5728\u805a\u5408\u90bb\u5c45\u7279\u5f81\u65f6\u7ed9\u4e88\u4e0d\u540c\u90bb\u5c45\u4e0d\u540c\u7684\u91cd\u89c6\u7a0b\u5ea6\u3002\u6700\u540e\uff0cLSTM\u53ef\u4ee5\u7075\u6d3b\u5904\u7406\u4efb\u4f55\u957f\u5ea6\u7684\u8f93\u5165\u5e8f\u5217\uff0c\u5b83\u5728\u5904\u7406\u5177\u6709\u4e0d\u540c\u6570\u91cf\u90bb\u5c45\u7684\u8282\u70b9\u65f6\u4e0d\u9700\u8981\u989d\u5916\u7684\u586b\u5145\u6216\u622a\u65ad\u64cd\u4f5c\uff0c\u8fd9\u662f\u5904\u7406\u4e0d\u89c4\u5219\u56fe\u6570\u636e\u7684\u4e00\u4e2a\u4f18\u52bf\u3002<\/p>\n\n\n\n<p>\u603b\u7ed3\u4e00\u4e0b\uff0cGraphSAGE\u7684\u91cd\u8981\u6027\u4f53\u73b0\u5728\u7075\u6d3b\u7684\u8282\u70b9\u805a\u5408\u6846\u67b6\u4e0a\uff0c\u5c55\u793a\u4e86\u5728\u56fe\u795e\u7ecf\u7f51\u7edc\uff08GNN\uff09\u4e2d\u8282\u70b9\u4fe1\u606f\u805a\u5408\u7684\u591a\u6837\u5316\u53ef\u80fd\u6027\u3002GraphSAGE\u4e0d\u4ec5\u5c40\u9650\u4e8e\u4f7f\u7528\u7b80\u5355\u7684\u5e73\u5747\uff08Mean\uff09\u64cd\u4f5c\u6765\u805a\u5408\u8282\u70b9\u7279\u5f81\uff0c\u8fd8\u63d0\u51fa\u4e86\u4f7f\u7528\u5e26\u53c2\u6570\u7684\u7f51\u7edc\u7ed3\u6784\uff0c\u5982MLP\uff08\u591a\u5c42\u611f\u77e5\u5668\uff09\u548cLSTM\uff08\u957f\u77ed\u671f\u8bb0\u5fc6\u7f51\u7edc\uff09\uff0c\u4ee5\u589e\u5f3a\u805a\u5408\u8fc7\u7a0b\u7684\u8868\u8fbe\u80fd\u529b\u548c\u7075\u6d3b\u6027\u3002\u8fd9\u5f00\u542f\u4e86\u4f7f\u7528\u66f4\u590d\u6742\u7684\u6a21\u578b\u6765\u5904\u7406\u56fe\u4e2d\u8282\u70b9\u7684\u53ef\u80fd\u6027\u3002\u5f53\u7136\u4e5f\u53ef\u4ee5\u5c1d\u8bd5\u6362\u6210\u5176\u4ed6\u7684\u7f51\u7edc\u7ed3\u6784\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u4efb\u52a1\u7684\u9700\u6c42\u548c\u6570\u636e\u7684\u7279\u70b9\u8fdb\u884c\u5b9a\u5236\uff0c\u4ee5\u5b9e\u73b0\u6700\u4f73\u6027\u80fd\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8e\u90a3\u4e9b\u8282\u70b9\u95f4\u4ea4\u4e92\u975e\u5e38\u590d\u6742\u6216\u56fe\u7ed3\u6784\u5feb\u901f\u53d8\u5316\u7684\u5e94\u7528\u573a\u666f\uff0c\u4f7f\u7528\u9ad8\u7ea7\u7684\u805a\u5408\u7b56\u7565\u5982Transformer\u53ef\u80fd\u66f4\u52a0\u6709\u6548\uff0c\u4e0b\u4e00\u5c0f\u8282\u7684\u8bb2\u89e3\u7684GAT\u6a21\u578b\u4fbf\u662f\u7531\u6b64\u5f97\u5230\u542f\u53d1\u88ab\u63d0\u51fa\u7684\u6a21\u578b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76f8\u6bd4GCN\uff0cGraphSAGE\u53ef\u4ee5\u5904\u7406Inductive\u7c7b\u578b\u7684\u4efb\u52a1\u3002Inductive\u4efb\u52a1\u7684\u5173\u952e\u5728\u4e8e\u8bbe\u8ba1\u80fd\u591f\u826f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2274,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,26],"tags":[22],"class_list":["post-2273","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-23","category-26","tag-22"],"_links":{"self":[{"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/posts\/2273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2273"}],"version-history":[{"count":2,"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/posts\/2273\/revisions"}],"predecessor-version":[{"id":2280,"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/posts\/2273\/revisions\/2280"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/media\/2274"}],"wp:attachment":[{"href":"http:\/\/www.gnn.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2273"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}