So good it's scary

This Python-based framework has everything you need for building graph neural networks

Sarah Schlothauer
deep learning
© Shutterstock / Wachiraphorn Thongya

We’ve got another one to add to the impressive stack of deep learning uses. Spektral is for deep learning on graphs and uses the Keras API. While the project is still in progress, this Ph.D. worthy framework built in Python has everything you need for building graph neural networks.

Are you afraid of ghosts? Get a little spooky with this framework. Developed and maintained by PhD student Daniele Grattarola, Spektral is for deep learning on graphs with the Keras API.

Previously, we wrote about why you should learn Keras. Keras is fairly user-friendly, modular, and recommended by deep learning experts. (Yes, it has even been used to identify dog breeds.) On GitHub, Grattarola writes that Keras has a higher computational overhead than TensorFlow or PyTorch.

Not only is deep learning an in-demand skill, it’s just plain awesome.

Deep learning meets data visualization

Who doesn’t love graphs? They help us visualize information, they’re concise, and there’s something just so pleasing about data representation. We learn better with the use of data visualization, especially those of us who lean more towards a visual learning style.

This fascination we all have with seeing data represented in something easy to digest might just be, as Grattarola references, because of “Relational representation learning”. Grattarola recommends reading up on this in a paper published by Cornell University, “Relational inductive biases, deep learning, and graph networks“.

Now, onto Spektral. From the GitHub repo:

Spektral is a framework for relational representation learning, built in Python and based on the Keras API. The main purpose of this project is to provide a simple, fast, and scalable environment for fast experimentation.

Spektral contains a wide set of tools to build graph neural networks, and implements some of the most popular layers for graph deep learning so that you only need to worry about creating your models.

SEE ALSO: CosmoFlow lets astronomers harness the power of deep learning to learn the mysteries of deep space

The docs explain how the data representation works.

“Spektral uses a matrix-based representation for manipulating graphs and feeding them to neural networks. This approach is one of the most commonly used in the literature on graph neural networks, and it’s perfect to perform efficient computations on GPU.”

Get graphing!

Before you grab your proton pack and go, here’s what you’ll need to install Spektral and begin graphing neural networks.

Keras supports Python Python 2.7-3.6 and Python 3 is heavily recommended for Spektral. Even though Python 2 has not reached it’s end of maintenance yet, 2020 creeps closer and closer. (Hindsight is 2020; update to Python 3!)

Optional, but also recommend are three dependencies: RDKit, dyfunconn, and CDG. New Keras users also should install the GPU version of TensorFlow before Keras. However, if you’ve already used Keras you’ll be ready to go. (It also can integrate into other Keras projects you have.)

So far, Spektral has been tested on Ubuntu 16.04 and 18.04.

SEE ALSO: Achieving real-time machine learning and deep learning with in-memory computing

Spektral comes with a little warning that the documentation is still in progress and it may change before the first proper release. The API is not currently stable, but it is still very new. Of course, you can help with the development and open a pull request!

This is just one of the many creative and intelligent uses of deep learning libraries. We await any future releases from Spektral and look forward to seeing what else Grattarola does in the future with that shiny PhD.

Sarah Schlothauer

Sarah Schlothauer

All Posts by Sarah Schlothauer

Sarah Schlothauer is the editor for She received her Bachelor's degree from Monmouth University, West Long Branch, New Jersey. She currently lives in Frankfurt, Germany with her husband and cat where she enjoys reading, writing, and medieval reenactment. She is also the editor for Conditio Humana, an online magazine about ethics, AI, and technology.

Inline Feedbacks
View all comments