[pymvpa] Balancer: AttributeError _pattr

brice rebsamen brice.rebsamen at gmail.com
Thu Apr 7 16:07:16 UTC 2011


Hi

After having learned 0.4 I am now re-writting my code using 0.6. I notice
that several things have changed, for instance splitters become
partitioners, and nperlabel has disappeared. I am now using a Balancer in a
ChainNode with a partitioner (following one of the examples):

cv = CrossValidation(SMLR(), \
           ChainNode([NGroupPartitioner(5), Balancer()],space='partitions'),
\
           enable_ca=['stats','training_stats'])

I get an AttributeError, complaining about _pattr missing, which happens
while converting to string the Balancer (see below)


ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (103, 0))

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/media/data/Documents/CognitiveLoad/code/pycode/eeg/dataAnalysis.py in
<module>()
    222     attr = DataAttributes(sids=['S04'])
    223     ds = makeDataSetAllSubjects(attr)
--> 224     c = classify(ds,['1','5'],nfolds=3)
    225
    226

/media/data/Documents/CognitiveLoad/code/pycode/eeg/dataAnalysis.py in
classify(ds, labels, nfolds, show_confusion, classifier,
**kwargs)
    188            enable_ca=['stats','training_stats'])
    189
--> 190     terr = cv(DS)
    191
    192     if show_confusion:

/usr/lib/pymodules/python2.6/mvpa/base/learner.pyc in __call__(self, ds)
    220                                    "used and auto training is
disabled."
    221                                    % str(self))
--> 222         return super(Learner, self).__call__(ds)
    223
    224

/usr/lib/pymodules/python2.6/mvpa/base/node.pyc in __call__(self, ds)
     74
     75         self._precall(ds)
---> 76         result = self._call(ds)
     77         result = self._postcall(ds, result)
     78

/usr/lib/pymodules/python2.6/mvpa/measures/base.pyc in _call(self, ds)
    407         # always untrain to wipe out previous stats

    408         self.untrain()
--> 409         return super(CrossValidation, self)._call(ds)
    410
    411

/usr/lib/pymodules/python2.6/mvpa/measures/base.pyc in _call(self, ds)
    276         # run the node an all generated datasets

    277         results = []
--> 278         for i, sds in enumerate(generator.generate(ds)):
    279             if ca.is_enabled("datasets"):
    280                 # store dataset in ca


/usr/lib/pymodules/python2.6/mvpa/base/node.pyc in generate(self, ds,
startnode)
    245             else:
    246                 # otherwise feed them through the rest of the chain

--> 247                 for rgds in self.generate(gds, startnode=startnode +
1):
    248                     yield rgds
    249

/usr/lib/pymodules/python2.6/mvpa/base/node.pyc in generate(self, ds,
startnode)
    237                     % (self.__class__.__name__, ds.shape,
    238                        startnode + 1, len(self),
--> 239                        str(first_node)))
    240         # let the first node generator as many datasets as it
wants

    241         for gds in first_node.generate(ds):

/usr/lib/pymodules/python2.6/mvpa/generators/resampling.pyc in __str__(self)
    184
    185     def __str__(self):
--> 186         return _str(self, self._pattr, n=self.nruns,
limit=self._limit,
    187
assure=self._assure_permute)
    188

AttributeError: 'Balancer' object has no attribute '_pattr'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20110408/b1f9ed7c/attachment-0001.htm>


More information about the Pkg-ExpPsy-PyMVPA mailing list