Mike's Page

Informatics, Development, Cycling, Data, Travel ...

Month: April 2015

Some tools for using MVPA

During my PhD I used the Multivariate Pattern Analysis Toolbox (www.pni.princeton.edu/mvpa), a Matlab-based toolbox to facilitate multi-voxel pattern analysis of neuroimaging data. I’ve made several alterations/additions to the tool, which others might find useful:

Data preprocessing

Multiclass SVM Classification

Just a note, as lots of people have asked:

The MVPA toolbox contains a two class SVM classifier (train_svm). Ryan Mruczek wrote a wrapper for the Chih-Chung Chang and Chih-Jen Lin’s svm library, and posted it on the MVPA group. We’ve hosted the train and test files here for ease of use. To use it, you will also need to download libSVM from the download section of Chang and Lin’s SVM website.

Boltzmann Machine pattern classifier for fMRI using the MVPA toolbox

The MVPA toolbox contains several classifiers such as linear regression, support vector machines etc. To supplement these, we have worked on a generative classifier which uses Restricted Boltzmann Machines (RBM). The general principle behind an individual RBM is that one alters the weights to make the visible nodes activity similar to one of the classes of training data. This can be used as a generative classifier by seeing which of a set of RBMs has the lowest free energy when the test data is applied. The one with the lowest has been trained (probably) on data most similar to the test data. It is based on work by Tanya Schmah, Geoffrey Hinton, et al.
The training and test scripts are available here:

train_rbm.m, test_rbm.m [to add, needs to be recovered from archive]


One of the great contributions of psychophysics to psychology is the notion of measuring threshold, i.e. the signal strength required for a criterion level of response by the observer. Watson and Pelli (1983) described a maximum likelihood procedure, which they called QUEST, for estimating threshold. The Quest algorithm is an adaptive staircase method, you can think of it as a Bayesian toolbox for testing observers and estimating their thresholds. We have written Python implementations of the Quest algorithm that you can download here:

files: quest.py, test_quest.py [to add, need to be recovered from archive]

Other useful hints

Structural Equation Modelling. The link from the SPM site to the SEM extension is dead. Douglas Steele kindly linked me to this tutorial. But some of the links were dead and I had trouble getting the code to compile. So I’ve produced a step-by-step summary describing how to get it working.

Failing to install the online psychic

The online psychic is running happily on my local machine, but I needed to get it onto this webserver.

Unfortunately the server doesn’t have pandas, numpy, etc installed.

I tried downloading virtualenv, which when untarred and run generates its own module collection. But I found its version of pip didn’t work, “shared host SystemError: Cannot compile ‘Python.h’. “.

So the next option: Anaconda? (I’ve only 1Gb of space, turns out that’s not enough).

Back to virtualenv:

Install my own version of python: https://my.justhost.com/cgi/help/python-install

Then following the instructions here: http://stackoverflow.com/questions/24748084/installing-numpy-without-sudo

Combined with the help here:


(download virtualenv here: https://pypi.python.org/pypi/virtualenv#downloads )

It still didn’t work – there’s a problem with the configuration of virtualenv’s python. It might be better to scrap virtualenv and download all the modules etc that I’ll need and compile them. The only advantage of virtualenv was that it would provide pip etc.

New python executable in venv/bin/python
ERROR: The executable venv/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/home/.sites/81/site18/.users/89/mts-michael/python' (should be u'/home/.sites/81/site18/.users/89/mts-michael/venv')

© 2019 Mike's Page

Theme by Anders NorenUp ↑