Atomspace Visualization

From OpenCog
(Redirected from Atomspace visualizer)

Visualizing the OpenCog AtomSpace in a useful way is a complex matter and many different approaches may work well for different purposes. There have been several attempts to build AtomSpace visualization tools over the years; none have been particularly successful.

Visualization, Dashboards, Science

There are three basic classes of visualization tasks that are important for using the AtomSpace.

  • Basic visualization and demos. It would be nice to be able to run the demos, found in the examples git directory, and have them run live, in a web-browser, where complete beginners can poke around and play and see what happens. A version of the AtomSpace Explorer (described below) seems like a good starting point for that.
  • Dashboard. Actually using the AtomSpace usually means writing a large number of bash script to implement some data processing pipeline. Processing typically takes hours or days: it would be nice to monitor progress with something other than a plain text terminal. Each different batch process usually requires tweaking config parameters, or rewiring the pipeline in a different way. Like science experiments, you never do quite the same run twice. Some kind of processing and control dashboard would be nice. The latest suggestion is that something built from Graphana would be great! Graphana is very pretty! Graphana live demo
  • Journal system. Running lab experiments requires a notebook. Not only a log of the steps that were performed, but also charts and figures showing the results. For a single user, one very convenient way of recording stuff is to use LyX for word-processing, and to use gnuplot to create charts of data. The biggest drawback to these two is that they are single-user systems, and the publication format is PDF's.
For a multi-user system published on the web, something like Jupyter notebooks might be better. But we would need Jupyter for scheme (guile) code. And we would need to be able to version-control it. Something called "nbstripout" might be just the thing!? Solving this is not really urgent, until we get to the point of having two or more people collaborating on a science project.

Visualization requirements

Some things that a visualizer should do:

  • One is almost always interested in just a tiny subset of a million-atom AtomSpace. The most powerful way of selecting what you want is the BindLink. The visualizer needs to provide an easy-to-use GUI for BindLink, and graph only what it returns.
  • Graphing should not be of individual Atoms, but of structures. For example, the graph of (Evaluation (Predicate "eat") (List (Concept "Ben") (Concept "pizza"))) should not be five Atoms, but two labelled vertexes, and a labelled edge: Ben ---eats--> pizza. The BindLink should be used to return a set of labelled vertexes and edges, which can then be plotted.
  • Similarly, visualizations of genomes and proteomes, used in the agi-bio/MOZI project, need to display individual genes and proteins, and their interactions (up/down regulation, expression, etc.). These need to be decorated with annotations (such as the Gene Onotology GO number). We do NOT want to draw the individual Atoms. Again, BindLink should be usable for creating these abstractions.
  • Sometimes one does want to explore at the Atom level: in this case, there should be an easy way to show just the nearest neighbors (i.e the incoming set). Or maybe neighbors of a given type.
  • Visualizing Values is important, two. Most commonly used are TruthValues and AttentionValues; there are others too.
  • Values are, in general, time-changing. Somehow showing this would be .. nice.

Some older specifications and ideas for how visualization could be performed:

Promising technologies

Things worth looking into:

  • OGDF - the Open Graph Drawing Framework - OGDF is a self-contained C++ library for graph algorithms, in particular for (but not restricted to) automatic graph drawing. It offers sophisticated algorithms and data structures to use within your own applications or scientific projects. The library is available under the GNU General Public License.
  • Cytoscape
  • Gephi

AtomSpace Explorer

The latest (as of October, 2017) visualization tool, and the preferred platform going forward, is the AtomSpace Explorer. This was adapted from the Mozi_Visualizer demo, which in turn was based on the former Glimpse visualizer. See the README file for instructions on how to install and use the AtomSpace Explorer.

Unfortunately, it has bit-rotted. It uses an obsolete Atom layout, and the API it uses to access Atoms is dead. It looks pretty cool from the demos, but needs a total overhaul.

Gene Annotation Service

This is a specialty tool for working with and annotating genomic data stored in the AtomSpace. See https://github.com/MOZI-AI/annotation-service

A related component is the Gene Ontlogy Visualizer. See https://github.com/Habush/annotation-graph

Dead code

The Gephi code below sounds cool but it seems to have disappeared. No one knows where it went. The Dotty and Tulip visualizers were weekend hacks that never did anything fancy.

Gephi

Visualization using Gephi is integrated with the CogServer using Python.

Steps for use under Ubuntu Linux:

  1. Start the Gephi application, including the Graph Streaming Server available in Gephi via "Tools > Plugins > Available Plugins."
  2. In the "Streaming" tab of the Gephi GUI, right-click the Master Server to start it.
  3. Start cogserver & telnet to it
  4. From the opencog shell, run loadpy adaptors. This should find GephiMindAgent. If not, check PYTHON_EXTENSION_DIRS in your opencog.conf
  5. Load some atoms into the atomspace. For example,
    scm-eval (clear) (load-scm-from-file "SomeAtoms.scm") (count-all)
    
  6. From the opencog shell, run `agents-step adaptors.GephiMindAgent`
  7. You should now see your atoms in Gephi.

(optional) Tips for new Gephi users for nice presentation:

  1. In the 'Layout' Tab, select the 'Force Atlas 2' layout.
  2. Click the check-boxes in the Layout settings for 'Dissuade Hubs' and 'Prevent Overlap'
  3. Click Run


(optional) Color coding:

  1. Select the 'Partition' tab and the 'Nodes' sub-tab.
  2. Click the green refresh icon below the the tabs. This should populate the parameters drop-down.
  3. Select "Label" in the drop-down.
  4. Click the 'Apply' button.

Dotty

Generates dotty graphs. You probably want to use it with GraphViz. See https://github.com/opencog/visualization

Tulip

Generates data for the Tulip data visualization toolkit. Tulip is actively maintained, and provides many powerful visualization features. See https://github.com/opencog/visualization

AtomSpace Viewer

This tool is implemented using HTML5 and JavaScript. Bit-rotted. See the "obsolete" subdirectory in https://github.com/opencog/external-tools/ AtomViewer.jpg

GTK Visualizer

A GTK App. Very old. Bit-rotted, for sure. See https://github.com/opencog/visualization This is Erwwin Joosten's old code.

Atomspace visualizer.png

Glimpse

See the "obsolete" subdirectory in https://github.com/opencog/external-tools/

Hypergraph to graph conversion

In order to map Atoms into existing graph visualizers, one must map the OpenCog hypergraph into a conventional graph. Code that does this was written by Junfei Guo in 2008, and is in a rar file here: File:UpdateFinalEvaluation.rar.