Examples

Denali comes complete with a variety of examples. All of these examples are located in the /examples folder, directly under the project root. Most of these examples are designed to show how the various features of denali can be used for various purposes. In particular, the callback system is demonstrated. The examples use the included pydenali python module, and may require that several python packages be installed. Note that pydenali is included with your download, but not automatically installed. To install pydenali, see the pydenali documentation.

To run these examples, you first need to know where they are. This depends on your operating system:



./tutorial

Description: This is the example referenced throughout the tutorial. It demonstrates color maps, weight maps, and a simple callback. The data being visualized is a toy tree; there isn't much to interpret.

Files:

The following files are referred to in the section on computing a contour tree from a point cloud:

Usage: See the tutorial

./clustering

Description: 647 images of handwritten digits (consisting of zeros, ones, and sevens) are hierarchically clustered using single-linkage clustering. The resulting tree is visualized. This demo shows the rich callback system by displaying an average image of the digits in the selected component in a new window.

Files:

Usage: Load the mnist_017.tree file in denali. The three classes of digits are represented by "plateaus" in the landscape. To explore the landscape more thoroughly, we'll use the callback. Select File → Configure Callbacks to open the callbacks dialog. We'll use an Async callback. Browse for the callback file, and select Run on selection and Supply subtree. Click Ok, and right click to select a component of the landscape. An image will appear, showing the average of all of the digits in the subtree induced by your selection.

./comments

Description: An comment thread from a website which features hierarchical discussions was scraped, and 954 comments were downloaded. Each comment has an unbounded integer score rating its popularity. This naturally yields a scalar tree, but for the ease of visualization, we make a slight adjustment to the scalar value of each node. The scalar value associated with a comment is taken to be its score, plus the score of its parent comment. This causes the landscape to grow upward.

Highlighted by this example are the color map and callback features. The callback prints the selected comment to the status box.

Files:

Usage: Open the tree in denali and set the root node to be "0". This node is artificially inserted into the tree to be a parent of all of the top-level comments. Next, set the color map by selecting File → Configure Color Map. Browse for the color map file. Set the "Contributors" to Child and the reduction to Maximum. The particular reduction used doesn't matter in this case, as we're only using the child node in the reduction set.

To see the content of individual comments, we'll use the callback function. As before, load the callback, but as an Info callback rather than an Async callback. Right click to select a component. The comment's score and content will be printed to the status box.

./neural

Description: A neural network model's parameter space. Several neural nets are trained on a noisy sampling of the sine function, and the parameter space is sampled around some of the local minima found. This example demonstrates the callback system. Whenever the user selects a component of the landscape, the corresponding model is evaluated and plotted in comparison to the ideal sine function and the training data. The callback requires the neurolab python package.

Files:

Usage: First, load the tree.tree file into denali. By default, denali chooses the node with the minimum scalar value to be the root. Since this tree visualizes the cost function, it is more natural to set the root to be the node with the maximum scalar value. Click Choose Root, then select the Maximum node radio button, then hit Ok.

Next, we'll use the callback to gain an understanding of the cost landscape. Select File → Configure Callbacks. We'll run this callback asynchronously. Click Browse in the Async Callback section, and select the callback.py file. Next, select Run on selection, then hit Ok.

Right clicking on a component will extract the parameter associated with the child node of the arc, evaluate the network using that parameter vector, and plot the model on the interval [0, 2 \pi]. Also shown in the plot are the ideal sine function (dashed line), and the noisy training samples (blue dots). By exploring, we see that the global minimum tends to overfit the data, while two plateaus corresponding to local minima then to underfit the data.

./pdf

Description: A mixture of three Gaussians in four dimensions is sampled. Each sample is associated with the density at that point in space. The contour tree of the density is computed, and the result is visualized as a landscape. A callback is provided which resamples the pdf locally whenever the user selects a region. Upon resampling, the contour tree is recomputed and the landscape is seamlessly updated.

Files:

Usage: As an optional first step, we'll generate some random data. The vertices, edges, and tree.tree files should already be included in the folder, but if you'd like to generate new random samples, simply run ./initialize.py. This will overwrite the previously mentioned files.

Next, load tree.tree in denali. You can load the info_callback.py script as a info callback. The sampling_callback.py script can be used as a tree callback. Neither of these callbacks require that the subtree be provided.

With both callbacks active, selecting a component of the landscape will print some information about the selection to the status box, and automatically resample the pdf and redraw the landscape.

Previous: Tutorial | Next: Cookbook