@@ -2,7 +2,6 @@ using GeometricFlux, Flux, JLD2, SparseArrays, DiffEqFlux, DifferentialEquations
22using Flux: onehotbatch, onecold, logitcrossentropy, throttle
33using Flux: @epochs
44using Statistics: mean
5- using Graphs: adjacency_matrix
65using CUDA
76
87# Load the dataset
@@ -20,22 +19,22 @@ epochs = 40
2019# Preprocess the data and compute adjacency matrix
2120train_X = Matrix {Float32} (features) |> gpu # dim: num_features * num_nodes
2221train_y = Float32 .(labels) |> gpu # dim: target_catg * num_nodes
23- adj_mat = Matrix {Float32} ( adjacency_matrix (g) ) |> gpu
22+ fg = FeaturedGraph (g ) |> gpu
2423
2524# Define the Neural GDE
2625diffeqarray_to_array (x) = reshape (gpu (x), size (x)[1 : 2 ])
2726
2827node = NeuralODE (
29- GCNConv (adj_mat , hidden=> hidden) |> gpu,
28+ GCNConv (fg , hidden=> hidden) |> gpu,
3029 (0.f0 , 1.f0 ), Tsit5 (), save_everystep = false ,
3130 reltol = 1e-3 , abstol = 1e-3 , save_start = false
3231)
3332
34- model = Chain (GCNConv (adj_mat , num_features=> hidden, relu),
33+ model = Chain (GCNConv (fg , num_features=> hidden, relu),
3534 Dropout (0.5 ),
3635 node,
3736 diffeqarray_to_array,
38- GCNConv (adj_mat , hidden=> target_catg),
37+ GCNConv (fg , hidden=> target_catg),
3938 softmax) |> gpu
4039
4140# Loss
0 commit comments