Skip to content

tbohlen/human-gibbs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Human-Gibbs-Sampler Comparison

Human-Gibbs is a website and set of gibbs sampler methods to compare human-generated sorting step data with gibbs sampler steps.

Must have the following python packages installed in order to the webserver. The packages can be found on PIP.

  • flask
  • pymongo

Data storage format

There are two collections in the mongo database: trials and image_sets

Trials

A trial is recorded by saving the initial state, the sequence of moves that the user makes, and a reference to the image set the trial is using. The fields for a trial are 'init_state', 'moves', 'image_set', and of course '_id'. Trials will be referred to by the document ID generated by Mongo. The 'image_set' field holds a DBRef to the document in images collection stores holds the images used.

State

The state is defined by a list of all the objects on the board. Each object has the fields 'image_id', 'group', 'x', 'y'. The 'image_id' is the image_id in the gridFS system for the image corresponding to the object. The 'group' field is -1 if it is unassigned. x and y are -1 if the image is not on the board yet. A sample object is shown below:

{'image_id': 34,
 'group': 3,
 'x': 25,
 'y': 193}

Only the initial state is stored in the trial's Mongo document, but the state at any point can be reconstructed by the list of moves.

Moves A move is defined the fields 'image_id', 'old_group',

'new_group', 'old_x', 'new_x', 'old_y', 'new_y', 'time_elapsed'. The 'image_id' field is for the image of the object that was moved, the "old" keys refer to the state of the object before the move, the "new" keys refer to the state of the objects after the move, and 'time_elapsed' refers to the time that the user took to make the move.

Image Sets

Each document in the images collection is simply composed of a 'name' field and an 'images' field. The 'images' field is a list of image dicts. Each will have at least the key 'image_id' corresponding to its ObjectIds in the GridFS system; to get the appropriate image need to run fs.get(id) from a GridFS object created for the 'human-gibbs' db

Pulling data from MongoHQ

Get the username, password, etc. from the MONGO_URL environment variable on Heroku. The MONGO_URL environment variable will be of the form:

MONGOHQ_URL: mongodb://<username>:<password>@<host>:<port>/<db-name>

Then run the following command:

$ mongodump -h <host>:<port> -d <db-name> -u <username> -p <password> -o /path/to/dump

To put this data into your local instance of MongoDB (assuming it is on the default port and doesn't require authentication), run:

$ mongorestore -d human-gibbs /path/to/dump --drop

About

Human-to-gibbs sampling comparison

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published