Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
labmlai
GitHub Repository: labmlai/annotated_deep_learning_paper_implementations
Path: blob/master/translate_cache/graphs/gat/experiment.zh.json
4934 views
1
{
2
"<h1>Train a Graph Attention Network (GAT) on Cora dataset</h1>\n": "<h1>\u5728 Cora \u6570\u636e\u96c6\u4e0a\u8bad\u7ec3\u56fe\u6ce8\u610f\u529b\u7f51\u7edc (GAT)</h1>\n",
3
"<h2><a href=\"https://linqs.soe.ucsc.edu/data\">Cora Dataset</a></h2>\n<p>Cora dataset is a dataset of research papers. For each paper we are given a binary feature vector that indicates the presence of words. Each paper is classified into one of 7 classes. The dataset also has the citation network.</p>\n<p>The papers are the nodes of the graph and the edges are the citations.</p>\n<p>The task is to classify the nodes to the 7 classes with feature vectors and citation network as input.</p>\n": "<h2><a href=\"https://linqs.soe.ucsc.edu/data\">Cora \u6570\u636e\u96c6</a></h2>\n<p>Cora \u6570\u636e\u96c6\u662f\u7814\u7a76\u8bba\u6587\u7684\u6570\u636e\u96c6\u3002\u5bf9\u4e8e\u6bcf\u7bc7\u8bba\u6587\uff0c\u6211\u4eec\u90fd\u5f97\u5230\u4e00\u4e2a\u4e8c\u8fdb\u5236\u7279\u5f81\u5411\u91cf\uff0c\u8be5\u5411\u91cf\u8868\u793a\u5355\u8bcd\u7684\u5b58\u5728\u3002\u6bcf\u7bc7\u8bba\u6587\u5206\u4e3a 7 \u4e2a\u7c7b\u522b\u4e4b\u4e00\u3002\u8be5\u6570\u636e\u96c6\u8fd8\u5177\u6709\u5f15\u6587\u7f51\u7edc\u3002</p>\n<p>\u8bba\u6587\u662f\u56fe\u7684\u8282\u70b9\uff0c\u8fb9\u7f18\u662f\u5f15\u6587\u3002</p>\n<p>\u4efb\u52a1\u662f\u4f7f\u7528\u7279\u5f81\u5411\u91cf\u548c\u5f15\u6587\u7f51\u7edc\u4f5c\u4e3a\u8f93\u5165\uff0c\u5c06\u8282\u70b9\u5206\u7c7b\u4e3a 7 \u7c7b\u3002</p>\n",
4
"<h2>Configurations</h2>\n": "<h2>\u914d\u7f6e</h2>\n",
5
"<h2>Graph Attention Network (GAT)</h2>\n<p>This graph attention network has two <a href=\"index.html\">graph attention layers</a>.</p>\n": "<h2>Graph \u6ce8\u610f\u529b\u7f51\u7edc (GAT)</h2>\n<p>\u8fd9\u4e2a\u56fe\u5f62\u5173\u6ce8\u7f51\u7edc\u6709\u4e24\u4e2a<a href=\"index.html\">\u56fe\u5f62\u5173\u6ce8\u5c42</a>\u3002</p>\n",
6
"<h3>Training loop</h3>\n<p>We do full batch training since the dataset is small. If we were to sample and train we will have to sample a set of nodes for each training step along with the edges that span across those selected nodes.</p>\n": "<h3>\u8bad\u7ec3\u5faa\u73af</h3>\n<p>\u7531\u4e8e\u6570\u636e\u96c6\u5f88\u5c0f\uff0c\u6211\u4eec\u8fdb\u884c\u5168\u6279\u91cf\u8bad\u7ec3\u3002\u5982\u679c\u8981\u8fdb\u884c\u91c7\u6837\u548c\u8bad\u7ec3\uff0c\u6211\u4eec\u5c06\u4e0d\u5f97\u4e0d\u4e3a\u6bcf\u4e2a\u8bad\u7ec3\u6b65\u9aa4\u5bf9\u4e00\u7ec4\u8282\u70b9\u4ee5\u53ca\u8de8\u8d8a\u8fd9\u4e9b\u9009\u5b9a\u8282\u70b9\u7684\u8fb9\u8fdb\u884c\u91c7\u6837\u3002</p>\n",
7
"<p> </p>\n": "<p></p>\n",
8
"<p> A simple function to calculate the accuracy</p>\n": "<p>\u8ba1\u7b97\u7cbe\u5ea6\u7684\u7b80\u5355\u51fd\u6570</p>\n",
9
"<p> Create Cora dataset</p>\n": "<p>\u521b\u5efa Cora \u6570\u636e\u96c6</p>\n",
10
"<p> Create GAT model</p>\n": "<p>\u521b\u5efa GAT \u6a21\u578b</p>\n",
11
"<p> Create configurable optimizer</p>\n": "<p>\u521b\u5efa\u53ef\u914d\u7f6e\u7684\u4f18\u5316\u5668</p>\n",
12
"<p> Download the dataset</p>\n": "<p>\u4e0b\u8f7d\u6570\u636e\u96c6</p>\n",
13
"<p> Load the dataset</p>\n": "<p>\u52a0\u8f7d\u6570\u636e\u96c6</p>\n",
14
"<p>Activation function </p>\n": "<p>\u6fc0\u6d3b\u529f\u80fd</p>\n",
15
"<p>Activation function after first graph attention layer </p>\n": "<p>\u7b2c\u4e00\u4e2a\u56fe\u5f62\u5173\u6ce8\u5c42\u4e4b\u540e\u7684\u6fc0\u6d3b\u529f\u80fd</p>\n",
16
"<p>Adam optimizer </p>\n": "<p>Adam \u4f18\u5316\u5668</p>\n",
17
"<p>Add an empty third dimension for the heads </p>\n": "<p>\u4e3a\u5934\u90e8\u6dfb\u52a0\u4e00\u4e2a\u7a7a\u7684\u7b2c\u4e09\u4e2a\u7ef4\u5ea6</p>\n",
18
"<p>Adjacency matrix with the edge information. <span translate=no>_^_0_^_</span> is <span translate=no>_^_1_^_</span> if there is an edge from <span translate=no>_^_2_^_</span> to <span translate=no>_^_3_^_</span>. </p>\n": "<p>\u5305\u542b\u8fb9\u4fe1\u606f\u7684\u90bb\u63a5\u77e9\u9635\u3002<span translate=no>_^_0_^_</span><span translate=no>_^_1_^_</span>\u5982\u679c\u5b58\u5728\u4ece<span translate=no>_^_2_^_</span>\u5230\u7684\u8fb9\u7f18<span translate=no>_^_3_^_</span>\u3002</p>\n",
19
"<p>Apply dropout to the input </p>\n": "<p>\u5c06\u4e22\u5931\u5e94\u7528\u4e8e\u8f93\u5165</p>\n",
20
"<p>Calculate configurations. </p>\n": "<p>\u8ba1\u7b97\u914d\u7f6e\u3002</p>\n",
21
"<p>Calculate gradients </p>\n": "<p>\u8ba1\u7b97\u68af\u5ea6</p>\n",
22
"<p>Calculate the loss for validation nodes </p>\n": "<p>\u8ba1\u7b97\u9a8c\u8bc1\u8282\u70b9\u7684\u635f\u5931</p>\n",
23
"<p>Create an experiment </p>\n": "<p>\u521b\u5efa\u5b9e\u9a8c</p>\n",
24
"<p>Create configurations </p>\n": "<p>\u521b\u5efa\u914d\u7f6e</p>\n",
25
"<p>Dataset </p>\n": "<p>\u6570\u636e\u96c6</p>\n",
26
"<p>Device to train on</p>\n<p>This creates configs for device, so that we can change the device by passing a config value </p>\n": "<p>\u7528\u4e8e\u8bad\u7ec3\u7684\u8bbe\u5907</p>\n<p>\u8fd9\u5c06\u4e3a\u8bbe\u5907\u521b\u5efa\u914d\u7f6e\uff0c\u4ee5\u4fbf\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4f20\u9012\u914d\u7f6e\u503c\u6765\u66f4\u6539\u8bbe\u5907</p>\n",
27
"<p>Download dataset </p>\n": "<p>\u4e0b\u8f7d\u6570\u636e\u96c6</p>\n",
28
"<p>Dropout </p>\n": "<p>\u8f8d\u5b66</p>\n",
29
"<p>Dropout probability </p>\n": "<p>\u8f8d\u5b66\u6982\u7387</p>\n",
30
"<p>Empty adjacency matrix - an identity matrix </p>\n": "<p>\u7a7a\u90bb\u63a5\u77e9\u9635-\u6052\u7b49\u77e9\u9635</p>\n",
31
"<p>Evaluate the model </p>\n": "<p>\u8bc4\u4f30\u6a21\u578b</p>\n",
32
"<p>Evaluate the model again </p>\n": "<p>\u518d\u6b21\u8bc4\u4f30\u6a21\u578b</p>\n",
33
"<p>Feature vectors for all nodes </p>\n": "<p>\u6240\u6709\u8282\u70b9\u7684\u7279\u5f81\u5411\u91cf</p>\n",
34
"<p>Final graph attention layer where we average the heads </p>\n": "<p>\u6700\u540e\u4e00\u5f20\u56fe\u5173\u6ce8\u5c42\uff0c\u6211\u4eec\u5e73\u5747\u5934\u90e8</p>\n",
35
"<p>First graph attention layer </p>\n": "<p>\u7b2c\u4e00\u4e2a\u56fe\u5f62\u5173\u6ce8\u5c42</p>\n",
36
"<p>First graph attention layer where we concatenate the heads </p>\n": "<p>\u6211\u4eec\u8fde\u63a5\u5934\u90e8\u7684\u7b2c\u4e00\u4e2a\u56fe\u5f62\u6ce8\u610f\u5c42</p>\n",
37
"<p>Get the class names and assign an unique integer to each of them </p>\n": "<p>\u83b7\u53d6\u7c7b\u540d\u5e76\u4e3a\u6bcf\u4e2a\u7c7b\u5206\u914d\u4e00\u4e2a\u552f\u4e00\u7684\u6574\u6570</p>\n",
38
"<p>Get the feature vectors </p>\n": "<p>\u83b7\u53d6\u7279\u5f81\u5411\u91cf</p>\n",
39
"<p>Get the labels as those integers </p>\n": "<p>\u83b7\u53d6\u8fd9\u4e9b\u6574\u6570\u7684\u6807\u7b7e</p>\n",
40
"<p>Get the loss for training nodes </p>\n": "<p>\u83b7\u5f97\u8bad\u7ec3\u8282\u70b9\u7684\u635f\u5931</p>\n",
41
"<p>Get the number of classes </p>\n": "<p>\u83b7\u53d6\u73ed\u7ea7\u6570</p>\n",
42
"<p>Get the paper ids </p>\n": "<p>\u83b7\u53d6\u7eb8\u8d28\u8bc1\u4ef6</p>\n",
43
"<p>Labels for each node </p>\n": "<p>\u6bcf\u4e2a\u8282\u70b9\u7684\u6807\u7b7e</p>\n",
44
"<p>Load the citations, it&#x27;s a list of pairs of integers. </p>\n": "<p>\u52a0\u8f7d\u5f15\u6587\uff0c\u8fd9\u662f\u4e00\u4e2a\u6574\u6570\u5bf9\u7684\u5217\u8868\u3002</p>\n",
45
"<p>Log the accuracy </p>\n": "<p>\u8bb0\u5f55\u51c6\u786e\u6027</p>\n",
46
"<p>Log the loss </p>\n": "<p>\u8bb0\u5f55\u635f\u5931</p>\n",
47
"<p>Loss function </p>\n": "<p>\u4e8f\u635f\u51fd\u6570</p>\n",
48
"<p>Make all the gradients zero </p>\n": "<p>\u5c06\u6240\u6709\u6e10\u53d8\u8bbe\u4e3a\u96f6</p>\n",
49
"<p>Map of paper id to index </p>\n": "<p>\u7eb8\u5f20 ID \u5230\u7d22\u5f15\u7684\u6620\u5c04</p>\n",
50
"<p>Mark the citations in the adjacency matrix </p>\n": "<p>\u5728\u90bb\u63a5\u77e9\u9635\u4e2d\u6807\u8bb0\u5f15\u7528</p>\n",
51
"<p>Model </p>\n": "<p>\u578b\u53f7</p>\n",
52
"<p>Move the adjacency matrix to the device </p>\n": "<p>\u5c06\u90bb\u63a5\u77e9\u9635\u79fb\u81f3\u8bbe\u5907</p>\n",
53
"<p>Move the feature vectors to the device </p>\n": "<p>\u5c06\u7279\u5f81\u5411\u91cf\u79fb\u52a8\u5230\u8bbe\u5907</p>\n",
54
"<p>Move the labels to the device </p>\n": "<p>\u5c06\u6807\u7b7e\u79fb\u5230\u8bbe\u5907\u4e0a</p>\n",
55
"<p>No need to compute gradients </p>\n": "<p>\u65e0\u9700\u8ba1\u7b97\u68af\u5ea6</p>\n",
56
"<p>Nodes for training </p>\n": "<p>\u8bad\u7ec3\u8282\u70b9</p>\n",
57
"<p>Nodes for validation </p>\n": "<p>\u7528\u4e8e\u9a8c\u8bc1\u7684\u8282\u70b9</p>\n",
58
"<p>Normalize the feature vectors </p>\n": "<p>\u5f52\u4e00\u5316\u7279\u5f81\u5411\u91cf</p>\n",
59
"<p>Number of classes for classification </p>\n": "<p>\u7528\u4e8e\u5206\u7c7b\u7684\u7c7b\u6570</p>\n",
60
"<p>Number of features in the first graph attention layer </p>\n": "<p>\u7b2c\u4e00\u4e2a\u56fe\u5f62\u5173\u6ce8\u56fe\u5c42\u4e2d\u7684\u8981\u7d20\u6570</p>\n",
61
"<p>Number of features in the input </p>\n": "<p>\u8f93\u5165\u4e2d\u7684\u8981\u7d20\u6570\u91cf</p>\n",
62
"<p>Number of features per node in the input </p>\n": "<p>\u8f93\u5165\u4e2d\u6bcf\u4e2a\u8282\u70b9\u7684\u8981\u7d20\u6570</p>\n",
63
"<p>Number of heads </p>\n": "<p>\u5934\u6570</p>\n",
64
"<p>Number of nodes to train on </p>\n": "<p>\u8981\u8bad\u7ec3\u7684\u8282\u70b9\u6570</p>\n",
65
"<p>Number of training iterations </p>\n": "<p>\u8bad\u7ec3\u8fed\u4ee3\u6b21\u6570</p>\n",
66
"<p>Optimizer </p>\n": "<p>\u4f18\u5316\u5668</p>\n",
67
"<p>Output layer (without activation) for logits </p>\n": "<p>logits \u7684\u8f93\u51fa\u5c42\uff08\u672a\u6fc0\u6d3b\uff09</p>\n",
68
"<p>Random indexes </p>\n": "<p>\u968f\u673a\u7d22\u5f15</p>\n",
69
"<p>Read the paper ids, feature vectors, and labels </p>\n": "<p>\u9605\u8bfb\u7eb8\u5f20 ID\u3001\u7279\u5f81\u77e2\u91cf\u548c\u6807\u7b7e</p>\n",
70
"<p>Run the training </p>\n": "<p>\u8fd0\u884c\u8bad\u7ec3</p>\n",
71
"<p>Save logs </p>\n": "<p>\u4fdd\u5b58\u65e5\u5fd7</p>\n",
72
"<p>Set mode to evaluation mode for validation </p>\n": "<p>\u5c06\u6a21\u5f0f\u8bbe\u7f6e\u4e3a\u8bc4\u4f30\u6a21\u5f0f\u4ee5\u8fdb\u884c\u9a8c\u8bc1</p>\n",
73
"<p>Set of class names and an unique integer index </p>\n": "<p>\u4e00\u7ec4\u7c7b\u540d\u548c\u4e00\u4e2a\u552f\u4e00\u7684\u6574\u6570\u7d22\u5f15</p>\n",
74
"<p>Set the model to training mode </p>\n": "<p>\u5c06\u6a21\u578b\u8bbe\u7f6e\u4e3a\u8bad\u7ec3\u6a21\u5f0f</p>\n",
75
"<p>Start and watch the experiment </p>\n": "<p>\u5f00\u59cb\u89c2\u770b\u5b9e\u9a8c</p>\n",
76
"<p>Take optimization step </p>\n": "<p>\u91c7\u53d6\u4f18\u5316\u6b65\u9aa4</p>\n",
77
"<p>The pair of paper indexes </p>\n": "<p>\u4e00\u5bf9\u7eb8\u8d28\u7d22\u5f15</p>\n",
78
"<p>Training loop </p>\n": "<p>\u8bad\u7ec3\u5faa\u73af</p>\n",
79
"<p>We build a symmetrical graph, where if paper <span translate=no>_^_0_^_</span> referenced paper <span translate=no>_^_1_^_</span> we place an adge from <span translate=no>_^_2_^_</span> to <span translate=no>_^_3_^_</span> as well as an edge from <span translate=no>_^_4_^_</span> to <span translate=no>_^_5_^_</span>. </p>\n": "<p>\u6211\u4eec\u6784\u5efa\u4e00\u4e2a\u5bf9\u79f0\u7684\u56fe\u5f62\uff0c\u5982\u679c\u7eb8\u5f20<span translate=no>_^_0_^_</span>\u5f15\u7528\u4e86\u7eb8\u5f20\uff0c<span translate=no>_^_1_^_</span>\u6211\u4eec\u4f1a\u5728\u5176\u4e2d\u653e\u7f6e\u4e00\u4e2a\u4ece<span translate=no>_^_2_^_</span>\u5230\u7684\u5fbd\u7ae0<span translate=no>_^_3_^_</span>\u4ee5\u53ca\u4ece<span translate=no>_^_4_^_</span>\u5230<span translate=no>_^_5_^_</span>\u3002</p>\n",
80
"<p>Whether to include edges. This is test how much accuracy is lost if we ignore the citation network. </p>\n": "<p>\u662f\u5426\u5305\u62ec\u8fb9\u7f18\u3002\u8fd9\u662f\u6d4b\u8bd5\u5982\u679c\u6211\u4eec\u5ffd\u7565\u5f15\u6587\u7f51\u7edc\u4f1a\u635f\u5931\u591a\u5c11\u51c6\u786e\u6027\u3002</p>\n",
81
"<p>Whether to include the citation network </p>\n": "<p>\u662f\u5426\u5305\u62ec\u5f15\u6587\u7f51\u7edc</p>\n",
82
"<ul><li><span translate=no>_^_0_^_</span> is the features vectors of shape <span translate=no>_^_1_^_</span> </li>\n<li><span translate=no>_^_2_^_</span> is the adjacency matrix of the form <span translate=no>_^_3_^_</span> or <span translate=no>_^_4_^_</span></li></ul>\n": "<ul><li><span translate=no>_^_0_^_</span>\u662f\u5f62\u72b6\u7684\u7279\u5f81\u5411\u91cf<span translate=no>_^_1_^_</span></li>\n<li><span translate=no>_^_2_^_</span>\u662f\u5f62\u5f0f\u7684\u90bb\u63a5\u77e9\u9635<span translate=no>_^_3_^_</span>\u6216<span translate=no>_^_4_^_</span></li></ul>\n",
83
"<ul><li><span translate=no>_^_0_^_</span> is the number of features per node </li>\n<li><span translate=no>_^_1_^_</span> is the number of features in the first graph attention layer </li>\n<li><span translate=no>_^_2_^_</span> is the number of classes </li>\n<li><span translate=no>_^_3_^_</span> is the number of heads in the graph attention layers </li>\n<li><span translate=no>_^_4_^_</span> is the dropout probability</li></ul>\n": "<ul><li><span translate=no>_^_0_^_</span>\u662f\u6bcf\u4e2a\u8282\u70b9\u7684\u8981\u7d20\u6570</li>\n<li><span translate=no>_^_1_^_</span>\u662f\u7b2c\u4e00\u4e2a\u56fe\u5f62\u5173\u6ce8\u5c42\u4e2d\u7684\u8981\u7d20\u6570</li>\n<li><span translate=no>_^_2_^_</span>\u662f\u7c7b\u7684\u6570\u91cf</li>\n<li><span translate=no>_^_3_^_</span>\u662f\u56fe\u8868\u5173\u6ce8\u5c42\u4e2d\u7684\u5934\u90e8\u6570\u91cf</li>\n<li><span translate=no>_^_4_^_</span>\u662f\u8f8d\u5b66\u6982\u7387</li></ul>\n",
84
"This trains is a Graph Attention Network (GAT) on Cora dataset": "\u8fd9\u5217\u706b\u8f66\u662f Cora \u6570\u636e\u96c6\u4e0a\u7684\u56fe\u5f62\u6ce8\u610f\u529b\u7f51\u7edc (GAT)",
85
"Train a Graph Attention Network (GAT) on Cora dataset": "\u5728 Cora \u6570\u636e\u96c6\u4e0a\u8bad\u7ec3\u56fe\u5f62\u6ce8\u610f\u529b\u7f51\u7edc (GAT)"
86
}
87