[pymvpa] MVPA .4 and multi-feature RBF

Ray Schumacher subscriber100 at rjs.org
Fri Dec 16 00:17:52 UTC 2011


I'm using .4.7 and Py27 (no .6 Win binary ?), from 
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pymvpa actually...
We have been using CART to develop dtrees, but I'd like to test basis 
functions or SVMs.

I'm trying to develop a classifier for a data set with 48 (possibly 
useful) features, 29 data points, and one binary condition/model.
I create a dataset, but now how do I set up SVM, or another 
classifier, for my shape (29, 48) data?
I'm sorry but the examples etc. have not gotten me there, yet.

mvpa.misc.exceptions.DatasetError: Dataset handling exception: Length of sample
attribute 'labels' [48] has to match the number of samples [29].

Code so far:

import numpy
import mvpa
from mvpa.clfs.svm import RbfNuSVMC

fh = open('con4.csv', 'r')
lines = fh.readlines()
fh.close()
labels = lines[0].split(',')

data = numpy.zeros((len(lines)-1, len(labels)-3), dtype=numpy.float32)
print 'data shape', data.shape  ## (29, 48)
for smp in range(1,len(lines)-1):
     data[smp, :] = lines[smp].split(',')[3:]

ds = mvpa.datasets.Dataset(samples=data, labels=labels[3:], chunks=1, 
labels_map=True)
print data, ds.nfeatures

clf = RbfNuSVMC(probability=1,   enable_states=['probabilities'])
clf.train(ds)
print numpy.mean(clf.predict(ds.samples) == ds.labels)

I also get:
'gcc' is not recognized as an internal or external command,
operable program or batch file.
Warning: Extremely bad integrand behavior occurs at some points of the
   integration interval.
Warning: Extremely bad integrand behavior occurs at some points of the
   integration interval.
C:\Python27\lib\site-packages\numpy\lib\function_base.py:1881: 
RuntimeWarning: i
nvalid value encountered in _cdf_single_call (vectorized)
   _res = array(self.ufunc(*newargs),copy=False,

Best,

Ray Schumacher
Programmer/Consultant 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20111215/c38b13e7/attachment.html>


More information about the Pkg-ExpPsy-PyMVPA mailing list