Release 0.11.0
StellarGraph is a Python library for machine learning on graphs and networks. It offers state-of-the-art algorithms for graph machine learning, making it easy to discover patterns and answer questions about graph-structured data.
Get started with StellarGraph's newest graph machine learning features with pip install stellargraph
.
Major features and improvements
- The onboarding/getting-started process has been optimised and improved:
- The README has been rewritten to highlight our numerous demos, and how to get help #1081
- Example Jupyter notebooks can now be run directly in Google Colab and Binder, providing an easy way to get started with StellarGraph - simply click the and badges within each notebook. #1119.
- The new
demos/basics
directory contains two notebooks demonstrating how to construct aStellarGraph
object from Pandas, and from NetworkX #1074 - The GCN node classification demo now has more explanation, to serve as an introduction to graph machine learning using StellarGraph #1125
- New algorithms:
- Watch Your Step: computes node embeddings by simulating the effect of random walks, rather than doing them. #750.
- Deep Graph Infomax: performs unsupervised node representation learning #978.
- Temporal Random Walks (Continuous-Time Dynamic Network Embeddings): random walks that respect the time that each edge occurred (stored as edge weights) #1120.
- ComplEx: computes multiplicative complex-number embeddings for entities and relationships (edge types) in knowledge graphs, which can be used for link prediction. #901 #1080
- DistMult: computes multiplicative real-number embeddings for entities and relationships (edge types) in knowledge graphs, which can be used for link prediction. #755 #865 #1136
Breaking changes
- StellarGraph now requires TensorFlow 2.1 or greater, TensorFlow 2.0 is no longer supported #1008
- The legacy constructor using NetworkX graphs has been deprecated #1027. Migration: replace
StellarGraph(some_networkx_graph)
withStellarGraph.from_networkx(some_networkx_graph)
, and similarly forStellarDiGraph
. - The
build
method on model classes (such asGCN
) has been renamed toin_out_tensors
#1140. Migration: replacemodel.build()
withmodel.in_out_tensors()
. - The
node_model
andlink_model
methods on model classes has been replaced byin_out_tensors
#1140 (see that PR for the exact list of types). Migration: replacemodel.node_model()
withmodel.in_out_tensors()
ormodel.in_out_tensors(multiplicity=1)
, andmodel.node_model()
withmodel.in_out_tensors()
ormodel.in_out_tensors(multiplicity=2)
. - Re-exports of calibration and ensembling functionality from the top-level of the
stellargraph
module were deprecated, in favour of importing from thestellargraph.calibration
orstellargraph.ensemble
submodules directly #1107. Migration: replace uses ofstellargraph.Ensemble
withstellargraph.ensemble.Ensemble
, and similarly for the other names (see #1107 for all replacements). StellarGraph.to_networkx
parameters now useattr
to refer to NetworkX attributes, notname
orlabel
#973. Migration: for any named parameters ingraph.to_networkx(...)
, changenode_type_name=...
tonode_type_attr=...
and similarlyedge_type_name
toedge_type_attr
,edge_weight_label
toedge_weight_attr
,feature_name
tofeature_attr
.StellarGraph.nodes_of_type
is deprecated in favour of thenodes
method #1111. Migration: replacesome_graph.nodes_of_type(some_type)
withsome_graph.nodes(node_type=some_type)
.StellarGraph.info
parametersshow_attributes
andsample
were deprecated #1110- Some more layers and models had many parameters move from
**kwargs
to real arguments:Attri2Vec
(#1128),ClusterGCN
(#1129),GraphAttention
&GAT
(#1130),GraphSAGE
& its aggregators (#1142),HinSAGE
& its aggregators (#1143),RelationalGraphConvolution
&RGCN
(#1148). Invalid (e.g. incorrectly spelled) arguments would have been ignored previously, but now may fail with aTypeError
; to fix, remove or correct the arguments. - The
method="chebyshev"
option toFullBatchNodeGenerator
,FullBatchLinkGenerator
andGCN_Aadj_feats_op
has been removed for now, because it needed significant revision to be correctly implemented #1028 - The
fit_generator
,evaluate_generator
andpredict_generator
methods onEnsemble
andBaggingEnsemble
have been renamed tofit
,evaluate
andpredict
, to match the deprecation in TensorFlow 2.1 of thetensorflow.keras.Model
methods of the same name #1065. Migration: remove the_generator
suffix on these methods. - The
default_model
method onAttri2Vec
,GraphSAGE
andHinSAGE
has been deprecated, in favour ofin_out_tensors
#1145. Migration: replacemodel.default_model()
withmodel.in_out_tensors()
.
Experimental features
Some new algorithms and features are still under active development, and are available as an experimental preview. However, they may not be easy to use: their documentation or testing may be incomplete, and they may change dramatically from release to release. The experimental status is noted in the documentation and at runtime via prominent warnings.
- GCNSupervisedGraphClassification: supervised graph classification model based on Graph Convolutional layers (GCN) #929.
Bug fixes and other changes
StellarGraph.to_adjacency_matrix
is at least 15× faster on undirected graphs #932ClusterNodeGenerator
is now noticably faster, which makes training and predicting with aClusterGCN
model faster #1095. On a random graph with 1000 nodes and 5000 edges and 10 clusters, iterating over an epoch withq=1
(each clusters individually) is 2× faster, and is even faster for largerq
. The model in the Cluster-GCN demo notebook using Cora trains 2× faster overall.- The
node_features=...
parameter toStellarGraph.from_networkx
now only needs to mention the node types that have features, when passing a dictionary of Pandas DataFrames. Node types that aren't mentioned will automatically have no features (zero-length feature vectors). #1082 - A
subgraph
method was added toStellarGraph
for computing a node-induced subgraph #958 - A
connected_components
method was added toStellarGraph
for computing the nodes involved in each connected component in aStellarGraph
#958 - The
info
method onStellarGraph
now shows only 20 node and edge types by default to be more useful for graphs with many types #993. This behaviour can be customized with thetruncate=...
parameter. - The
info
method onStellarGraph
now shows information about the size and type of each node type's feature vectors #979 - The
EdgeSplitter
class supportsStellarGraph
input (and will outputStellarGraph
s in this case), in addition to NetworkX graphs #1032 - The
Attri2Vec
model class stores its weights statefully, so they are shared between all tensors computed bybuild
#1101 - The
GCN
model defaults for some parameters now match theGraphConvolution
layer's defaults: specificallykernel_initializer
(glorot_uniform
) andbias_initializer
(zeros
) #1147 - The
datasets
submodule is now accessible asstellargraph.datasets
, after justimport stellargraph
#1113 - All datasets in
stellargraph.datasets
now support aload
method to create aStellarGraph
object (and other information):AIFB
(#982),CiteSeer
(#989),Cora
(#913),MovieLens
(#947),PubMedDiabetes
(#986). The demo notebooks using these datasets are now cleaner. - Some new datasets were added to
stellargraph.datasets
:MUTAG
: a collection of graphs representing chemical compounds #960WN18
,WN18RR
: knowledge graphs based on the WordNet linguistics data #977FB15k
,FB15k_237
: knowledge graphs based on the FreeBase knowledge base #977IAEnronEmployees
: a small set of employees of Enron, and the many emails between them #1058
- Warnings now point to the call site of the function causing the warning, not the
warnings.warn
call inside StellarGraph; this meansDeprecationWarning
s will be visible in Jupyter notebooks and scripts run with Python 3.7 #1144 - Some code that triggered warnings from other libraries was fixed or removed #995 #1008, #1051, #1064, #1066
- Some demo notebooks have been updated or fixed:
demos/use-cases/hateful-twitters.ipynb
(#1019),rgcn-aifb-node-classification-example.ipynb
(#983) - The documentation "quick start" guide duplicated a lot of the information in the README, and so has been replaced with the latter #1096
- API documentation now lists items under their recommended import path, not their definition. For instance,
stellargraph.StellarGraph
instead ofstellargraph.core.StellarGraph
(#1127),stellargraph.layer.GCN
instead ofstellargraph.layer.gcn.GCN
(#1150) andstellargraph.datasets.Cora
instead ofstellargraph.datasets.datasets.Cora
(#1157) - Some API documentation is now formatted better #1061, #1068, #1070, #1071
- DevOps changes: