[pymvpa] Searchlight-MVPA-ValueError
J
la.foma at gmail.com
Wed Feb 24 16:21:39 UTC 2010
Dear all,
I am trying to run a very simple searchlight on fMRI data via PyLab
(on Mac Leopard).
My code is as follows:
from mvpa.suite import *
import os
from matplotlib.pyplot import figure, show
from mvpa.misc.io.base import SampleAttributes
from mvpa.datasets.nifti import NiftiDataset
if __debug__:
debug.active += ["SLC"]
attr = SampleAttributes(os.path.join(pymvpa_dataroot, 'attributes_test.txt'))
dataset = NiftiDataset(samples=os.path.join(pymvpa_dataroot,
'time_series_original_run_all.nii.gz'),
labels=attr.labels,
chunks=attr.chunks,
mask=os.path.join(pymvpa_dataroot,
'anatomy_mask.nii.gz'))
detrend(dataset, perchunk=True, model='linear')
zscore(dataset, perchunk=True, baselinelabels=[1], targetdtype='float32')
# choose classifier
clf = LinearCSVMC()
# setup measure to be computed by Searchlight
# cross-validated mean transfer using an Odd-Even dataset splitter
cv = CrossValidatedTransferError(TransferError(clf),
OddEvenSplitter())
cv = CrossValidatedTransferError(
transfer_error=TransferError(LinearCSVMC(),
splitter=OddEvenSplitter())
s1 = Searchlight(cv, radius=5)
s1_map = s1(dataset)
dataset.map2Nifti(s1_map).save('searchlight_5mm.nii.gz')
---
this runs fine for a while and then it crashes and gives me the
following errors which I am not sure what they mean.
optimization finished, #iter = 59
nu = 0.775000
obj = -0.000003, rho = -0.999986
nSV = 67, nBSV = 57
Total nSV = 414
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/<ipython
console> in <module>()
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mvpa/measures/base.pyc
in __call__(self, dataset)
103 container applying transformer if such is defined
104 """
--> 105 result = self._call(dataset)
106 result = self._postcall(dataset, result)
107 return result
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mvpa/measures/searchlight.pyc
in _call(self, dataset)
106
107 # compute the datameasure and store in results
--> 108 measure = self.__datameasure(sphere)
109 results.append(measure)
110
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mvpa/measures/base.pyc
in __call__(self, dataset)
103 container applying transformer if such is defined
104 """
--> 105 result = self._call(dataset)
106 result = self._postcall(dataset, result)
107 return result
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mvpa/algorithms/cvtranserror.pyc
in _call(self, dataset)
171
172 # run the beast
--> 173 result = transerror(split[1], split[0])
174
175 # unbind the testdataset from the classifier
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mvpa/clfs/transerror.pyc
in __call__(self, testdataset, trainingdataset)
1300 Returns a scalar value of the transfer error.
1301 """
-> 1302 self._precall(testdataset, trainingdataset)
1303 error = self._call(testdataset, trainingdataset)
1304 self._postcall(testdataset, trainingdataset, error)
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mvpa/clfs/transerror.pyc
in _precall(self, testdataset, trainingdataset)
1256 self.__clf.states._changeTemporarily(
1257 enable_states=['training_confusion'])
-> 1258 self.__clf.train(trainingdataset)
1259 if self.states.isEnabled('training_confusion'):
1260 self.training_confusion =
self.__clf.training_confusion
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mvpa/clfs/base.pyc
in train(self, dataset)
366
367 if dataset.nfeatures > 0:
--> 368 result = self._train(dataset)
369 else:
370 warning("Trying to train on dataset with no
features present")
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mvpa/clfs/libsvmc/svm.pyc
in _train(self, dataset)
185 libsvm_param._setParameter('weight', weight)
186
--> 187 self.__model = svm.SVMModel(svmprob, libsvm_param)
188
189
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mvpa/clfs/libsvmc/_svm.pyc
in __init__(self, arg1, arg2)
267 msg = svmc.svm_check_parameter(prob.prob, param.param)
268 if msg:
--> 269 raise ValueError, msg
270 self.model = svmc.svm_train(prob.prob, param.param)
271
ValueError: C <= 0
-------
Your input would be greatly appreciated.
Thanks a lot,
J
More information about the Pkg-ExpPsy-PyMVPA
mailing list