-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from JuliaML/cl/cora2
improve Cora + add PubMed and CiteSeer
- Loading branch information
Showing
19 changed files
with
424 additions
and
46 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
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 |
---|---|---|
|
@@ -18,7 +18,8 @@ jobs: | |
matrix: | ||
julia-version: ['1.0', '1', 'nightly'] | ||
os: [ubuntu-latest, windows-latest, macOS-latest] | ||
|
||
env: | ||
PYTHON: "" | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: "Set up Julia" | ||
|
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# CiteSeer | ||
|
||
```@docs | ||
CiteSeer | ||
``` | ||
|
||
## API reference | ||
|
||
```@docs | ||
CiteSeer.dataset | ||
``` |
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 |
---|---|---|
|
@@ -7,5 +7,5 @@ Cora | |
## API reference | ||
|
||
```@docs | ||
Cora.alldata | ||
Cora.dataset | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# PubMed | ||
|
||
```@docs | ||
PubMed | ||
``` | ||
|
||
## API reference | ||
|
||
```@docs | ||
PubMed.dataset | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Utils | ||
|
||
```@docs | ||
MLDatasets.read_planetoid_data | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
export CiteSeer | ||
|
||
|
||
""" | ||
CiteSeer | ||
The CiteSeer citation network dataset from Ref. [1]. | ||
Nodes represent documents and edges represent citation links. | ||
The dataset is designed for the node classification task. | ||
The task is to predict the category of certain paper. | ||
The dataset is retrieved from Ref. [2]. | ||
## Interface | ||
- [`CiteSeer.dataset`](@ref) | ||
## References | ||
[1]: [Deep Gaussian Embedding of Graphs: Unsupervised Inductive Learning via Ranking](https://arxiv.org/abs/1707.03815) | ||
[2]: [Planetoid](https://github.com/kimiyoung/planetoid) | ||
""" | ||
module CiteSeer | ||
|
||
using DataDeps | ||
using ..MLDatasets: datafile, read_planetoid_data | ||
using DelimitedFiles: readdlm | ||
|
||
using PyCall | ||
|
||
const DEPNAME = "CiteSeer" | ||
const LINK = "https://github.com/kimiyoung/planetoid/raw/master/data" | ||
const DOCS = "https://github.com/kimiyoung/planetoid" | ||
const DATA = "ind.citeseer." .* ["x", "y", "tx", "allx", "ty", "ally", "graph", "test.index"] | ||
|
||
function __init__() | ||
register(DataDep( | ||
DEPNAME, | ||
""" | ||
Dataset: The $DEPNAME dataset. | ||
Website: $DOCS | ||
""", | ||
map(x -> "$LINK/$x", DATA), | ||
"7f7ec4df97215c573eee316de35754d89382011dfd9fb2b954a4a491057e3eb3", # if checksum omitted, will be generated by DataDeps | ||
# post_fetch_method = unpack | ||
)) | ||
end | ||
|
||
""" | ||
dataset(; dir=nothing, reverse_edges=true) | ||
Retrieve the CiteSeer dataset. The output is a named tuple with fields | ||
```juliarepl | ||
julia> keys(CiteSeer.dataset()) | ||
(:node_features, :node_labels, :adjacency_list, :train_indices, :val_indices, :test_indices, :num_classes, :num_nodes, :num_edges, :directed) | ||
``` | ||
In particular, `adjacency_list` is a vector of vector, | ||
where `adjacency_list[i]` will contain the neighbors of node `i` | ||
through outgoing edges. | ||
If `reverse_edges=true`, the graph will contain | ||
the reverse of each edge and the graph will be undirected. | ||
See also [`CiteSeer`](@ref). | ||
## Usage Examples | ||
```julia | ||
using MLDatasets: CiteSeer | ||
data = CiteSeer.dataset() | ||
train_labels = data.node_labels[data.train_indices] | ||
``` | ||
""" | ||
dataset(; dir=nothing, reverse_edges=true) = | ||
read_planetoid_data(DEPNAME, dir=dir, reverse_edges=reverse_edges) | ||
|
||
|
||
end #module | ||
|
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
Oops, something went wrong.
eeb8298
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
eeb8298
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/41615
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: