topic model visualization
Switch branches/tags
Nothing to show
Clone or download



Allison J. B. Chaney

(C) Copyright 2011-2014, Allison J. B. Chaney

This is free software, you can redistribute it and/or modify it under
the terms of the GNU General Public License.

The GNU General Public License does not permit this software to be
redistributed in proprietary programs.

This software is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of


This code uses the Django web framework [],
which will need to be installed. On Unix systems, this can be done with:

    sudo pip install Django
    currently requires 1.2.4

The BasicBrowser is an interface that lazily generates pages to display
the results of a topic model.  Since each page querys the database, the
browser can keep pace with online topic models, displaying current data.
It can also be used with topic models that are not online.


* BasicBrowser: a directory containing an online topic model browser,
    written in Python using the Django framework.
    * static: directory containing javascript, css, image files
    * templates: directory containing template html files with Django
        tags and filters
    * tmv_app: directory containing models and views files for the browser
        (see Django doc for more details)
    * a file to control writes to the database; this is generally
        the file imported into external topic model source (see wiki example)
    * all other .py files that come standard with Django (see Django doc
        for details)
* a modified version of the Python script that comes
    with Online LDA (see below for source)
* Readme.txt: This file.
* COPYING: A copy of the GNU public license version 3.


A demonstration of this browser can be run with the Wikipedia demo
included with the Online LDA source:

If you are not familiar with the Online LDA source, it is recommended that
you read its readme and explore its demo before proceeding.

To run the browser with the Wikipedia demo, substitute the original
[] file with provided replacement. For example:

    cp online-tmve/ onlineldavb/

All paths to the database need to be absolute, so modify the following
lines accordingly., line 27
    BasicBrowser/, line 15

Finally, before running the demo, the database needs to be created.  In
the BasicBrowser directory, run

    python syncdb

At this point the Online LDA demo can be run as specified in its readme, e.g.

    python 101

to run the algorithms for 101 iterations (which isn't very long).

To view the browser, run the following in the BasicBrowser directory:

    python runserver

and navigate to the following link in a web browser, reloading as desired.
(The topics make take a while to be created and populated with terms.)

Viewing a given page of the browser make take longer while the topic model
is running than it does after the run completes.

If you want to start over again, remove the database file, sync the database
again before restarting the model.

    rm tmv_db; python syncdb

To install the browser on a web server, see the Django documentation.


The browser can be used for any topic model, even if the model is not online.
For algorithms written in Python, simply import the file and use its
functions to write to the database.  For algorithms not written in Python,
you need only write your data to the database, which can be done directly
with sqlite3, by embeding the file in your code, or by using any other
method that works for you.  If you have the output of a model in a file, it
might be easiest to write a python script to transfer that data using
It shoudl be noted that as written, uses a separate thread for most
writes to the database; this may not be ideal for all applications.