← All posts

DreamCatcher: Deep Learning and Graph Analytics for the Dreamscape

Kineviz · · 3 min read

DreamCatcher: Deep Learning and Graph Analytics for the Dreamscape

by Ana Areias

Dive into dreams and explore the subconscious terrain with GraphXR and Neo4j using dream reports provided by UCSC’s Dreambank. Using deep learning for NLP and text-to-image generation, follow along with this blog to learn how we build a dream similarity graph to visualize, identify, and interpret dream clusters.

While the choice of dreams data is a bit tongue-in-cheek, the methodology we use here can be applied in many other domains in order to make sense of large amounts of data, find hidden connections and create compelling visualizations.

Shared Dreams in a Dream Similarity Graph

The Dreambank data consists of almost 30,000 dream journal entries spanning several decades submitted by 74 different dreamers.

This GraphXR view below shows dreams for the dreamer “UCSC_women” connected to similar dreams across other dreamers. The visualization evokes a dream catcher and shows which dreamers UCSC_women have the most dreams in common with.

To build the Dream Similarity Graph we captured the vector representation of each dream using a Gensim Doc2Vec model trained on the dream content. We gage how similar two dreams are by their cosine similarity. The pairwise similarity score across all dreams builds a K-nearest neighbors graph where each node is a dream connected to the k most similar dreams with a similarity score above a threshold.

Click here to open this view in GraphXR Click here to open this view in GraphXR

Dream Interpretation with Community Detection and Named Entity Recognition

To interpret the meaning of our dreams we deploy a community detection algorithm to identify dream clusters powered by Neo4j, using SpaCy Named Entity Recognition to tease out mentions of people, organizations, locations, dates and other informative categories. In this way, we build a topical, high-level view of the clusters.

This GraphXR view shows all dreams for the dreamer “jasmine4” and the people and places most frequently mentioned in her dreams. Jasmine4’s dreams are arrayed in a circle in order of date dreamt and entity node size as a function of frequency of mentions across dreams. This allows us to see how the main topics of her dreams evolve across time.

Click here to open this view in GraphXR Click here to open this view in GraphXR

Dream snapshots with neural-network powered text-to-image generation

We make the graph visualization even more immersive by running the first couple sentences of each dream through a neural network image generator ( Aleph2Image Delta built from OpenAI’s Clip model and Dall-e decoder developed by tech artist @advadnoun). The resulting images have a hazy, otherworldly quality about them.

This GraphXR view shows a dream cluster related to sports since most of the dreams mention football, baseball games and many of the entities extracted are player and team names or cities. If you hover over the dream nodes you can see the beginning sentences of the dream that were fed to a neural network to generate the resulting dream snapshot.

Click here to open this view in GraphXR Click here to open this view in GraphXR

The GraphXR environment provides a unique space for us to analyze the dreamscape and map out the collective subconscious in an intuitive and exploratory way. You can follow along in Jupyter notebook below with step-by-step instructions on how to process the data, upload to a local Neo4j instance running on a Docker container and connect your GraphXR account.

🔗 [Notebook on nbviewer

What are the main topics that a dreamer dreams about? Here we look at the entities (persons, locations, date, etc)…nbviewer.jupyter.org](https://nbviewer.jupyter.org/github/areias/dreams/blob/aaabfc697669510a4ee7588d40c2134dc36110bd/code/dream_catcher.ipynb#loading)

As Data Scientist for Kineviz, Ana works with merging deep learning and graph technologies in GraphXR to better understand high dimensional and interconnected data. GraphXR is a browser-based visual analytics platform built to address evolving scenarios and unforeseen questions. It was built on the principle that your questions should shape your data model, rather than adapt to it. Learn more at kineviz.com, visit our help center, and join our to learn more!

Originally published at https://www.kineviz.com on May 7, 2021.

Machine LearningData VisualizationData ScientistResearch And DevelopmentNeo4j Graph Database