Skip to content

Commit 07d3c48

Browse files
authored
Merge pull request #40 from tigergraph/GML-1406
GML-1406: update with main
2 parents 417c109 + 1e38146 commit 07d3c48

File tree

14 files changed

+6049
-918
lines changed

14 files changed

+6049
-918
lines changed

GNNs/PyG/hgat_node_classification.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@
404404
" out_units = out_dim if i == (num_layers - 1) else hidden_dim\n",
405405
" heads = 1 if i == (num_layers - 1) else num_heads\n",
406406
" self.layers.append(\n",
407-
" GATConv(in_units, out_units, heads=heads, dropout=dropout)\n",
407+
" GATConv(in_units, out_units, heads=heads, dropout=dropout, add_self_loops=False)\n",
408408
" )\n",
409409
"\n",
410410
" def reset_parameters(self):\n",
@@ -709,7 +709,7 @@
709709
" out_units = out_dim if i == (num_layers - 1) else hidden_dim\n",
710710
" heads = 1 if i == (num_layers - 1) else num_heads\n",
711711
" self.layers.append(\n",
712-
" GATConv(in_units, out_units, heads=heads, dropout=dropout)\n",
712+
" GATConv(in_units, out_units, heads=heads, dropout=dropout, add_self_loops=False)\n",
713713
" )\n",
714714
"\n",
715715
" def reset_parameters(self):\n",

GNNs/Spektral/gcn_node_classification.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@
389389
"optimizer = Adam(learning_rate=hp[\"lr\"])\n",
390390
"loss_fn = CategoricalCrossentropy()\n",
391391
"\n",
392-
"one_hot_y = to_categorical(y)\n",
392+
"one_hot_y = to_categorical(y, num_classes=7)\n",
393393
"tf_a = tf.SparseTensor(#converts the scipy sparse matrix to a tensorflow sparse matrix\n",
394394
" indices=np.array([adj.row, adj.col]).T,\n",
395395
" values=adj.data,\n",
@@ -673,13 +673,13 @@
673673
"outputs": [],
674674
"source": [
675675
"def preprocess_batch(graph):\n",
676-
" x, adj, y, mask_tr, mask_va, mask_te = graph.x, graph.A, graph.y, graph.train_mask, graph.val_mask, graph.test_mask\n",
677-
" one_hot_y = to_categorical(y)\n",
678-
" tf_a = tf.SparseTensor(#converts the scipy sparse matrix to a tensorflow sparse matrix\n",
679-
" indices=np.array([adj.row, adj.col]).T,\n",
680-
" values=adj.data,\n",
681-
" dense_shape=adj.shape)\n",
682-
" return x, tf_a, one_hot_y\n",
676+
" x, adj, y, mask_tr, mask_va, mask_te = graph.x, graph.A, graph.y, graph.train_mask, graph.val_mask, graph.test_mask\n",
677+
" one_hot_y = to_categorical(y, num_classes=7)\n",
678+
" tf_a = tf.SparseTensor(#converts the scipy sparse matrix to a tensorflow sparse matrix\n",
679+
" indices=np.array([adj.row, adj.col]).T,\n",
680+
" values=adj.data,\n",
681+
" dense_shape=adj.shape)\n",
682+
" return x, tf_a, one_hot_y\n",
683683
"\n",
684684
"val_acc_metric = tf.keras.metrics.CategoricalAccuracy()\n",
685685
"val_loss_metric = tf.keras.metrics.CategoricalCrossentropy()"
@@ -918,7 +918,7 @@
918918
"name": "python",
919919
"nbconvert_exporter": "python",
920920
"pygments_lexer": "ipython3",
921-
"version": "3.9.13"
921+
"version": "3.9.16"
922922
},
923923
"vscode": {
924924
"interpreter": {

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ We recommend starting with the tutorials in the `basics` folders if you are new
7979
| basics | [pyTigergraph_101.ipynb](./basics/pyTigergraph_101.ipynb) | Basic pyTigerGraph examples|
8080
| basics | [gsql_101.ipynb](./basics/gsql_101.ipynb) | Basic GSQL 101 using pyTigerGraph |
8181
| basics | [gsql_102.ipynb](./basics/gsql_102.ipynb) | Advanced GSQL 102 (pattern match) using pyTigerGraph |
82+
| basics | [template_query.ipynb](./basics/template_query.ipynb) | How to call template query with pyTigerGraph |
8283

8384
### 2. Graph Algorithms
8485

algos/embedding.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@
280280
},
281281
"outputs": [],
282282
"source": [
283-
"params={\"v_type\": [\"Paper\"],\n",
284-
" \"e_type\": [\"Cite\"],\n",
285-
" \"output_v_type\": [\"Paper\"],\n",
283+
"params={\"v_type_set\": [\"Paper\"],\n",
284+
" \"e_type_set\": [\"Cite\"],\n",
285+
" \"output_v_type_set\": [\"Paper\"],\n",
286286
" \"iteration_weights\": \"1,2,4\",\n",
287287
" \"beta\": -0.1,\n",
288288
" \"embedding_dimension\": 128,\n",
@@ -785,7 +785,7 @@
785785
"name": "python",
786786
"nbconvert_exporter": "python",
787787
"pygments_lexer": "ipython3",
788-
"version": "3.9.6"
788+
"version": "3.9.15"
789789
},
790790
"vscode": {
791791
"interpreter": {

applications/fraud_detection/fraud_detection.ipynb

Lines changed: 1392 additions & 903 deletions
Large diffs are not rendered by default.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CREATE QUERY component_size(STRING result_attr) FOR GRAPH Ethereum {
2+
MapAccum<INT, SumAccum<INT>> @@component_count;
3+
4+
res = SELECT s FROM Account:s POST-ACCUM @@component_count += (s.wcc_id -> 1);
5+
6+
res = SELECT s FROM Account:s POST-ACCUM
7+
INT tmp = @@component_count.get(s.wcc_id),
8+
s.setAttr(result_attr, tmp);
9+
}

0 commit comments

Comments
 (0)