Unverified Commit 0ce92a86 authored by Kay Liu's avatar Kay Liu Committed by GitHub
Browse files

[BugFix] fix problems found in bug bash (#3116)



* fix breakline in fakenews.py

* fix inconsistent argument name

* modify incorrect example and deprecated graph type

* modify docstring and example in knn_graph

* fix incorrect node type
Co-authored-by: default avatarQuan (Andy) Gan <coin2028@hotmail.com>
parent c7449818
...@@ -43,17 +43,17 @@ python n_body_sim.py --num_traj <num_traj> --steps <num_steps> ...@@ -43,17 +43,17 @@ python n_body_sim.py --num_traj <num_traj> --steps <num_steps>
```python ```python
python train.py --number_workers 15 python train.py --num_workers 15
``` ```
Training with GPU Training with GPU
```python ```python
python train.py --gpu 0 --number_workers 15 python train.py --gpu 0 --num_workers 15
``` ```
Training with visualization: for valid visualization, it might take full 40000 epoch of training Training with visualization: for valid visualization, it might take full 40000 epoch of training
```python ```python
python train.py --gpu 0 --number_workers 15 --visualize python train.py --gpu 0 --num_workers 15 --visualize
``` ```
One Step Loss Performance, Loss of test data after 40000 training epochs. One Step Loss Performance, Loss of test data after 40000 training epochs.
......
...@@ -20,18 +20,10 @@ class FakeNewsDataset(DGLBuiltinDataset): ...@@ -20,18 +20,10 @@ class FakeNewsDataset(DGLBuiltinDataset):
who retweeted the root news. Besides, the node features are encoded who retweeted the root news. Besides, the node features are encoded
user historical tweets using different pretrained language models: user historical tweets using different pretrained language models:
- bert: the 768-dimensional node feature composed of Twitter user - bert: the 768-dimensional node feature composed of Twitter user historical tweets encoded by the bert-as-service
historical tweets encoded by the bert-as-service - content: the 310-dimensional node feature composed of a 300-dimensional “spacy” vector plus a 10-dimensional “profile” vector
- profile: the 10-dimensional node feature composed of ten Twitter user profile attributes.
- content: the 310-dimensional node feature composed of a - spacy: the 300-dimensional node feature composed of Twitter user historical tweets encoded by the spaCy word2vec encoder.
300-dimensional “spacy” vector plus a 10-dimensional
“profile” vector
- profile: the 10-dimensional node feature composed of ten Twitter
user profile attributes.
- spacy: the 300-dimensional node feature composed of Twitter user
historical tweets encoded by the spaCy word2vec encoder.
Note: this dataset is for academic use only, and commercial use is prohibited. Note: this dataset is for academic use only, and commercial use is prohibited.
......
...@@ -51,7 +51,7 @@ class FraudDataset(DGLBuiltinDataset): ...@@ -51,7 +51,7 @@ class FraudDataset(DGLBuiltinDataset):
---------- ----------
num_classes : int num_classes : int
Number of label classes Number of label classes
graph : dgl.heterograph.DGLHeteroGraph graph : dgl.DGLGraph
Graph structure, etc. Graph structure, etc.
seed : int seed : int
Random seed in splitting the dataset. Random seed in splitting the dataset.
...@@ -65,8 +65,8 @@ class FraudDataset(DGLBuiltinDataset): ...@@ -65,8 +65,8 @@ class FraudDataset(DGLBuiltinDataset):
>>> dataset = FraudDataset('yelp') >>> dataset = FraudDataset('yelp')
>>> graph = dataset[0] >>> graph = dataset[0]
>>> num_classes = dataset.num_classes >>> num_classes = dataset.num_classes
>>> feat = dataset.ndata['feature'] >>> feat = graph.ndata['feature']
>>> label = dataset.ndata['label'] >>> label = graph.ndata['label']
""" """
file_urls = { file_urls = {
'yelp': 'dataset/FraudYelp.zip', 'yelp': 'dataset/FraudYelp.zip',
...@@ -81,8 +81,8 @@ class FraudDataset(DGLBuiltinDataset): ...@@ -81,8 +81,8 @@ class FraudDataset(DGLBuiltinDataset):
'amazon': 'Amazon.mat' 'amazon': 'Amazon.mat'
} }
node_name = { node_name = {
'yelp': 'user', 'yelp': 'review',
'amazon': 'review' 'amazon': 'user'
} }
def __init__(self, name, raw_dir=None, random_seed=717, train_size=0.7, val_size=0.1): def __init__(self, name, raw_dir=None, random_seed=717, train_size=0.7, val_size=0.1):
...@@ -126,7 +126,7 @@ class FraudDataset(DGLBuiltinDataset): ...@@ -126,7 +126,7 @@ class FraudDataset(DGLBuiltinDataset):
Returns Returns
------- -------
:class:`dgl.heterograph.DGLHeteroGraph` :class:`dgl.DGLGraph`
graph structure, node features, node labels and masks graph structure, node features, node labels and masks
- ``ndata['feature']``: node features - ``ndata['feature']``: node features
...@@ -249,8 +249,8 @@ class FraudYelpDataset(FraudDataset): ...@@ -249,8 +249,8 @@ class FraudYelpDataset(FraudDataset):
>>> dataset = FraudYelpDataset() >>> dataset = FraudYelpDataset()
>>> graph = dataset[0] >>> graph = dataset[0]
>>> num_classes = dataset.num_classes >>> num_classes = dataset.num_classes
>>> feat = dataset.ndata['feature'] >>> feat = graph.ndata['feature']
>>> label = dataset.ndata['label'] >>> label = graph.ndata['label']
""" """
def __init__(self, raw_dir=None, random_seed=717, train_size=0.7, val_size=0.1): def __init__(self, raw_dir=None, random_seed=717, train_size=0.7, val_size=0.1):
...@@ -318,8 +318,8 @@ class FraudAmazonDataset(FraudDataset): ...@@ -318,8 +318,8 @@ class FraudAmazonDataset(FraudDataset):
>>> dataset = FraudAmazonDataset() >>> dataset = FraudAmazonDataset()
>>> graph = dataset[0] >>> graph = dataset[0]
>>> num_classes = dataset.num_classes >>> num_classes = dataset.num_classes
>>> feat = dataset.ndata['feature'] >>> feat = graph.ndata['feature']
>>> label = dataset.ndata['label'] >>> label = graph.ndata['label']
""" """
def __init__(self, raw_dir=None, random_seed=717, train_size=0.7, val_size=0.1): def __init__(self, raw_dir=None, random_seed=717, train_size=0.7, val_size=0.1):
......
...@@ -122,7 +122,7 @@ def knn_graph(x, k, algorithm='bruteforce-blas', dist='euclidean'): ...@@ -122,7 +122,7 @@ def knn_graph(x, k, algorithm='bruteforce-blas', dist='euclidean'):
This method is suitable for low-dimensional data (e.g. 3D This method is suitable for low-dimensional data (e.g. 3D
point clouds) point clouds)
* 'nn-descent' is a approximate approach from paper * 'nn-descent' is an approximate approach from paper
`Efficient k-nearest neighbor graph construction for generic similarity `Efficient k-nearest neighbor graph construction for generic similarity
measures <https://www.cs.princeton.edu/cass/papers/www11.pdf>`_. This method measures <https://www.cs.princeton.edu/cass/papers/www11.pdf>`_. This method
will search for nearest neighbor candidates in "neighbors' neighbors". will search for nearest neighbor candidates in "neighbors' neighbors".
...@@ -156,7 +156,7 @@ def knn_graph(x, k, algorithm='bruteforce-blas', dist='euclidean'): ...@@ -156,7 +156,7 @@ def knn_graph(x, k, algorithm='bruteforce-blas', dist='euclidean'):
... [0.3, 0.2, 0.4]]) ... [0.3, 0.2, 0.4]])
>>> knn_g = dgl.knn_graph(x, 2) # Each node has two predecessors >>> knn_g = dgl.knn_graph(x, 2) # Each node has two predecessors
>>> knn_g.edges() >>> knn_g.edges()
>>> (tensor([0, 1, 2, 2, 2, 3, 3, 3]), tensor([0, 1, 1, 2, 3, 0, 2, 3])) (tensor([0, 1, 2, 2, 2, 3, 3, 3]), tensor([0, 1, 1, 2, 3, 0, 2, 3]))
When :attr:`x` is a 3D tensor, DGL constructs multiple KNN graphs and When :attr:`x` is a 3D tensor, DGL constructs multiple KNN graphs and
and then composes them into a graph of multiple connected components. and then composes them into a graph of multiple connected components.
...@@ -297,7 +297,7 @@ def segmented_knn_graph(x, k, segs, algorithm='bruteforce-blas', dist='euclidean ...@@ -297,7 +297,7 @@ def segmented_knn_graph(x, k, segs, algorithm='bruteforce-blas', dist='euclidean
This method is suitable for low-dimensional data (e.g. 3D This method is suitable for low-dimensional data (e.g. 3D
point clouds) point clouds)
* 'nn-descent' is a approximate approach from paper * 'nn-descent' is an approximate approach from paper
`Efficient k-nearest neighbor graph construction for generic similarity `Efficient k-nearest neighbor graph construction for generic similarity
measures <https://www.cs.princeton.edu/cass/papers/www11.pdf>`_. This method measures <https://www.cs.princeton.edu/cass/papers/www11.pdf>`_. This method
will search for nearest neighbor candidates in "neighbors' neighbors". will search for nearest neighbor candidates in "neighbors' neighbors".
...@@ -533,7 +533,7 @@ def knn(k, x, x_segs, y=None, y_segs=None, algorithm='bruteforce', dist='euclide ...@@ -533,7 +533,7 @@ def knn(k, x, x_segs, y=None, y_segs=None, algorithm='bruteforce', dist='euclide
This method is suitable for low-dimensional data (e.g. 3D This method is suitable for low-dimensional data (e.g. 3D
point clouds) point clouds)
* 'nn-descent' is a approximate approach from paper * 'nn-descent' is an approximate approach from paper
`Efficient k-nearest neighbor graph construction for generic similarity `Efficient k-nearest neighbor graph construction for generic similarity
measures <https://www.cs.princeton.edu/cass/papers/www11.pdf>`_. This method measures <https://www.cs.princeton.edu/cass/papers/www11.pdf>`_. This method
will search for nearest neighbor candidates in "neighbors' neighbors". will search for nearest neighbor candidates in "neighbors' neighbors".
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment