Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
de14619c
"git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "d3ae7544cda01fa4c4804ab94bf0671b4868bcb5"
Unverified
Commit
de14619c
authored
Dec 19, 2023
by
Rhett Ying
Committed by
GitHub
Dec 19, 2023
Browse files
[GraphBolt] fix several issues in doc and notebook (#6775)
parent
1db71cfe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
7 deletions
+9
-7
docs/source/guide/minibatch-custom-sampler.rst
docs/source/guide/minibatch-custom-sampler.rst
+3
-3
docs/source/guide/minibatch-sparse.rst
docs/source/guide/minibatch-sparse.rst
+1
-1
notebooks/stochastic_training/link_prediction.ipynb
notebooks/stochastic_training/link_prediction.ipynb
+3
-2
notebooks/stochastic_training/node_classification.ipynb
notebooks/stochastic_training/node_classification.ipynb
+2
-1
No files found.
docs/source/guide/minibatch-custom-sampler.rst
View file @
de14619c
...
@@ -5,12 +5,12 @@
...
@@ -5,12 +5,12 @@
Implementing custom samplers involves subclassing the
Implementing custom samplers involves subclassing the
:class:`dgl.graphbolt.SubgraphSampler` base class and implementing its abstract
:class:`dgl.graphbolt.SubgraphSampler` base class and implementing its abstract
:attr:`
_
sample_subgraphs` method. The :attr:`
_
sample_subgraphs` method should
:attr:`sample_subgraphs` method. The :attr:`sample_subgraphs` method should
take in seed nodes which are the nodes to sample neighbors from:
take in seed nodes which are the nodes to sample neighbors from:
.. code:: python
.. code:: python
def
_
sample_subgraphs(self, seed_nodes):
def sample_subgraphs(self, seed_nodes):
return input_nodes, sampled_subgraphs
return input_nodes, sampled_subgraphs
The method should return the input node IDs list and a list of subgraphs. Each
The method should return the input node IDs list and a list of subgraphs. Each
...
@@ -31,7 +31,7 @@ The code below implements a classical neighbor sampler:
...
@@ -31,7 +31,7 @@ The code below implements a classical neighbor sampler:
self.graph = graph
self.graph = graph
self.fanouts = fanouts
self.fanouts = fanouts
def
_
sample_subgraphs(self, seed_nodes):
def sample_subgraphs(self, seed_nodes):
subgs = []
subgs = []
for fanout in reversed(self.fanouts):
for fanout in reversed(self.fanouts):
# Sample a fixed number of neighbors of the current seed nodes.
# Sample a fixed number of neighbors of the current seed nodes.
...
...
docs/source/guide/minibatch-sparse.rst
View file @
de14619c
...
@@ -29,7 +29,7 @@ will customize another sampler with DGL sparse library as shown below.
...
@@ -29,7 +29,7 @@ will customize another sampler with DGL sparse library as shown below.
fanout
=
torch
.
LongTensor
([
int
(
fanout
)])
fanout
=
torch
.
LongTensor
([
int
(
fanout
)])
self
.
fanouts
.
insert
(
0
,
fanout
)
self
.
fanouts
.
insert
(
0
,
fanout
)
def
_
sample_subgraphs
(
self
,
seeds
):
def
sample_subgraphs
(
self
,
seeds
):
sampled_matrices
=
[]
sampled_matrices
=
[]
src
=
seeds
src
=
seeds
...
...
notebooks/stochastic_training/link_prediction.ipynb
View file @
de14619c
...
@@ -54,7 +54,8 @@
...
@@ -54,7 +54,8 @@
"os.environ['TORCH'] = torch.__version__\n",
"os.environ['TORCH'] = torch.__version__\n",
"os.environ['DGLBACKEND'] = \"pytorch\"\n",
"os.environ['DGLBACKEND'] = \"pytorch\"\n",
"\n",
"\n",
"# Install the CPU version.\n",
"# Install the CPU version. If you want to install CUDA version, please\n",
"# refer to https://www.dgl.ai/pages/start.html.\n",
"device = torch.device(\"cpu\")\n",
"device = torch.device(\"cpu\")\n",
"!pip install --pre dgl -f https://data.dgl.ai/wheels-test/repo.html\n",
"!pip install --pre dgl -f https://data.dgl.ai/wheels-test/repo.html\n",
"\n",
"\n",
...
@@ -339,7 +340,7 @@
...
@@ -339,7 +340,7 @@
"# Compute the AUROC score.\n",
"# Compute the AUROC score.\n",
"from sklearn.metrics import roc_auc_score\n",
"from sklearn.metrics import roc_auc_score\n",
"\n",
"\n",
"auc = roc_auc_score(labels, logits)\n",
"auc = roc_auc_score(labels
.cpu()
, logits
.cpu()
)\n",
"print(\"Link Prediction AUC:\", auc)"
"print(\"Link Prediction AUC:\", auc)"
],
],
"metadata": {
"metadata": {
...
...
notebooks/stochastic_training/node_classification.ipynb
View file @
de14619c
...
@@ -54,7 +54,8 @@
...
@@ -54,7 +54,8 @@
"os.environ['TORCH'] = torch.__version__\n",
"os.environ['TORCH'] = torch.__version__\n",
"os.environ['DGLBACKEND'] = \"pytorch\"\n",
"os.environ['DGLBACKEND'] = \"pytorch\"\n",
"\n",
"\n",
"# Install the CPU version.\n",
"# Install the CPU version. If you want to install CUDA version, please\n",
"# refer to https://www.dgl.ai/pages/start.html.\n",
"device = torch.device(\"cpu\")\n",
"device = torch.device(\"cpu\")\n",
"!pip install --pre dgl -f https://data.dgl.ai/wheels-test/repo.html\n",
"!pip install --pre dgl -f https://data.dgl.ai/wheels-test/repo.html\n",
"\n",
"\n",
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment