Wow -- nice finding Fabian! I wonder what should be the resolution... and why even the confusion since shogun's SVC_Q lies in shogun space (not sure how well that is represented in dynamic library, or may be on your box shogun/libsvm and pymvpa were built with DYLD_FORCE_FLAT_NAMESPACE or smth like that)
Unfortunately it isn't the case of the segfaults I can reproduce :-/
(if you have a moment/desire -- try running the unittests extract which
supposed to trigger it)
On Tue, 09 Mar 2010, Fabian Pedregosa wrote:
> Thanks for looking at this. I solved the problem by uninstalling
> shogun. It seems the problem was due to name clashing between libsvm
> & shogun. The stack trace is interesting:
> 0 libshogun.4.dylib 0x03f87656 SVC_Q::get_Q(int, int)
> const + 54
> 1 libsvm.dylib 0x0425ecd9
> Solver::select_working_set(int&, int&) + 777
> 2 libsvm.dylib 0x0426109a Solver::Solve(int,
> QMatrix const&, double const*, signed char const*, double*, double,
> double, double, Solver::SolutionInfo*, int) + 778
> which means it 'jumps' from libsvm to shogun (I have no clue why
> this happens)
--
.-.
=------------------------------ /v\ ----------------------------=
Keep in touch // \\ (yoh@|www.)onerussian.com
Yaroslav Halchenko /( )\ ICQ#: 60653192
Linux User ^^-^^ [175555]
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
"""Unit tests for PyMVPA basic Classifiers"""
from mvpa.support.copy import deepcopy
from mvpa.base import externals
from mvpa.datasets.base import dataset_wizard
from mvpa.datasets.splitters import NFoldSplitter, OddEvenSplitter
from mvpa.misc.exceptions import UnknownStateError
from mvpa.clfs.base import DegenerateInputError, FailedToTrainError, \
FailedToPredictError
from mvpa.clfs.meta import CombinedClassifier, \
BinaryClassifier, MulticlassClassifier, \
SplitClassifier, MappedClassifier, FeatureSelectionClassifier, \
TreeClassifier, RegressionAsClassifier
from mvpa.clfs.transerror import TransferError
from mvpa.algorithms.cvtranserror import CrossValidatedTransferError
from mvpa.mappers.flatten import mask_mapper
from mvpa.misc.attrmap import AttributeMap
from mvpa.mappers.fx import mean_sample
from mvpa.testing import *
from mvpa.testing.datasets import *
from mvpa.testing.clfs import *
# What exceptions to allow while testing degenerate cases.
# If it pukes -- it is ok -- user will notice that something
# is wrong
_degenerate_allowed_exceptions = [
DegenerateInputError, FailedToTrainError, FailedToPredictError]
class ClassifiersTests(unittest.TestCase):
@sweepargs(lrn=regrswh['!meta', '!sg', 'libsvm', 'EPSILON_SVR'])
def test_custom_targets(self, lrn):
"""Simple test if a learner could cope with custom sa not targets
"""
# Since we are comparing performances of two learners, we need
# to assure that if they depend on some random seed -- they
# would use the same value. Currently we have such stochastic
# behavior in SMLR
if 'seed' in lrn.params:
from mvpa import _random_seed
lrn = lrn.clone() # clone the beast
lrn.params.seed = _random_seed # reuse the same seed
lrn_ = lrn.clone()
lrn_.params.targets_attr = 'custom'
te = CrossValidatedTransferError(TransferError(lrn),
NFoldSplitter())
te_ = CrossValidatedTransferError(TransferError(lrn_),
NFoldSplitter())
nclasses = 2 * (1 + int('multiclass' in lrn.__tags__))
dsname = ('uni%dsmall' % nclasses,
'sin_modulated')[int(lrn.__is_regression__)]
ds = datasets[dsname]
ds_ = ds.copy()
ds_.sa['custom'] = ds_.sa['targets']
ds_.sa.pop('targets')
self.failUnless('targets' in ds.sa,
msg="'targets' should remain in original ds")
try:
cve = te(ds)
cve_ = te_(ds_)
except Exception, e:
self.fail("Failed with %r" % e)
assert_array_almost_equal(cve, cve_)
"We should have got very similar errors while operating on "
"'targets' and on 'custom'. Got %r and %r." % (cve, cve_)
# TODO: sg/libsvm segfaults
# GPR -- non-linear sensitivities
if ('has_sensitivity' in lrn.__tags__
#and not 'sg' in lrn.__tags__
#and not 'libsvm' in lrn.__tags__
and not ('gpr' in lrn.__tags__
and 'non-linear' in lrn.__tags__)
):
## if str(lrn) == "SVM(svm_impl='EPSILON_SVR', kernel=LinearLSKernel())":
## # TODO investigate segfault
## import pydb
## pydb.debugger()
s = lrn.get_sensitivity_analyzer()(ds)
s_ = lrn_.get_sensitivity_analyzer()(ds_)
isreg = lrn.__is_regression__
# ^ is XOR so we shouldn't get get those sa's in
# regressions at all
self.failUnless(('custom' in s_.sa) ^ isreg)
self.failUnless(('targets' in s.sa) ^ isreg)
self.failUnless(not 'targets' in s_.sa)
self.failUnless(not 'custom' in s.sa)
if not 'smlr' in lrn.__tags__ or \
cfg.getboolean('tests', 'labile', default='yes'):
assert_array_almost_equal(s.samples, s_.samples)
if __name__ == '__main__':
unittest.TextTestRunner(verbosity = 1).run(
unittest.makeSuite(ClassifiersTests))
signature.asc
Description: Digital signature
_______________________________________________ Pkg-ExpPsy-PyMVPA mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pymvpa

