-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2dd14fd
commit 306da07
Showing
14 changed files
with
104 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,44 @@ | ||
# Datasets | ||
|
||
GNNGraphs.jl doesn't come with its own datasets, but leverages those available in the Julia (and non-Julia) ecosystem. In particular, the [examples in the GraphNeuralNetworks.jl repository](https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/tree/master/examples) make use of the [MLDatasets.jl](https://github.com/JuliaML/MLDatasets.jl) package. There you will find common graph datasets such as Cora, PubMed, Citeseer, TUDataset and [many others](https://juliaml.github.io/MLDatasets.jl/dev/datasets/graphs/). | ||
GNNGraphs.jl doesn't come with its own datasets, but leverages those available in the Julia (and non-Julia) ecosystem. | ||
|
||
## MLDatasets.jl | ||
|
||
Some of the [examples in the GraphNeuralNetworks.jl repository](https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/tree/master/examples) make use of the [MLDatasets.jl](https://github.com/JuliaML/MLDatasets.jl) package. There you will find common graph datasets such as Cora, PubMed, Citeseer, TUDataset and [many others](https://juliaml.github.io/MLDatasets.jl/dev/datasets/graphs/). | ||
For graphs with static structures and temporal features, datasets such as METRLA, PEMSBAY, ChickenPox, and WindMillEnergy are available. For graphs featuring both temporal structures and temporal features, the TemporalBrains dataset is suitable. | ||
|
||
GraphNeuralNetworks.jl provides the [`mldataset2gnngraph`](@ref) method for interfacing with MLDatasets.jl. | ||
|
||
## PyGDatasets.jl | ||
|
||
The package [PyGDatasets.jl](https://github.com/CarloLucibello/PyGDatasets.jl) makes available to Julia users the datasets from the [pytorch geometric](https://pytorch-geometric.readthedocs.io/en/latest/modules/datasets.html) library. | ||
|
||
PyGDatasets' datasets are compatible with GNNGraphs, so no additional conversion is needed. | ||
```julia | ||
julia> using PyGDatasets | ||
|
||
julia> dataset = load_dataset("TUDataset", name="MUTAG") | ||
TUDataset(MUTAG) - InMemoryGNNDataset | ||
num_graphs: 188 | ||
node_features: [:x] | ||
edge_features: [:edge_attr] | ||
graph_features: [:y] | ||
root: /Users/carlo/.julia/scratchspaces/44f67abd-f36e-4be4-bfe5-65f468a62b3d/datasets/TUDataset | ||
|
||
julia> g = dataset[1] | ||
GNNGraph: | ||
num_nodes: 17 | ||
num_edges: 38 | ||
ndata: | ||
x = 7×17 Matrix{Float32} | ||
edata: | ||
edge_attr = 4×38 Matrix{Float32} | ||
gdata: | ||
y = 1-element Vector{Int64} | ||
|
||
julia> using MLUtils: DataLoader | ||
|
||
julia> data_loader = DataLoader(dataset, batch_size=32); | ||
``` | ||
|
||
PyGDatasets is based on [PythonCall.jl](https://github.com/JuliaPy/PythonCall.jl). It carries over some heavy dependencies such as python, pytorch and pytorch geometric. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
# Taken from https://github.com/JuliaDiff/ChainRules.jl/pull/648 | ||
# Remove when merged | ||
|
||
function ChainRulesCore.rrule(::Type{T}, ps::Pair...) where {T<:Dict} | ||
function CRC.rrule(::Type{T}, ps::Pair...) where {T<:Dict} | ||
ks = map(first, ps) | ||
project_ks, project_vs = map(ProjectTo, ks), map(ProjectTo∘last, ps) | ||
project_ks, project_vs = map(CRC.ProjectTo, ks), map(CRC.ProjectTo ∘ last, ps) | ||
function Dict_pullback(ȳ) | ||
dy = CRC.unthunk(ȳ) | ||
dps = map(ks, project_ks, project_vs) do k, proj_k, proj_v | ||
dk, dv = proj_k(getkey(ȳ, k, NoTangent())), proj_v(get(ȳ, k, NoTangent())) | ||
Tangent{Pair{typeof(dk), typeof(dv)}}(first = dk, second = dv) | ||
dk, dv = proj_k(getkey(dy, k, CRC.NoTangent())), proj_v(get(dy, k, CRC.NoTangent())) | ||
CRC.Tangent{Pair{typeof(dk), typeof(dv)}}(first = dk, second = dv) | ||
end | ||
return (NoTangent(), dps...) | ||
return (CRC.NoTangent(), dps...) | ||
end | ||
return T(ps...), Dict_pullback | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
[deps] | ||
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" | ||
DiffEqFlux = "aae7a2af-3d4f-5e19-a356-7da93b79d9d0" | ||
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa" | ||
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" | ||
GraphNeuralNetworks = "cffab07f-9bc2-4db1-8861-388f63bf7694" | ||
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" | ||
MLDatasets = "eb30cadb-4394-5ae3-aed4-317e484a6458" | ||
MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54" | ||
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" | ||
NNlibCUDA = "a00861dc-f156-4864-bf3c-e6376f28a68d" | ||
|
||
[compat] | ||
DiffEqFlux = "2" | ||
Flux = "0.13" | ||
GraphNeuralNetworks = "0.6" | ||
Flux = "0.16" | ||
GraphNeuralNetworks = "1" | ||
Graphs = "1" | ||
MLDatasets = "0.7" | ||
julia = "1.9" | ||
julia = "1.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters