Re: [pymvpa] PyMVPA Growing Nerual Gas implementation

2014-01-24 Thread Tiziano Zito
Hi Tony,

you can actually use the MDP GNG implementation directly in PyMVPA
using the MDPFlowMapper. An example of how to use MDP within PyMVPA
can be found here:

http://www.pymvpa.org/examples/mdp_mnist.html

HTH,
Tiziano

On Thu 23 Jan, 15:42, Jiang, Zhiguo zhiguo.ji...@njit.edu wrote:
 Hi, All
 
 this might be unrelated to PyMVPA. but I am trying to find a good
 implementation of clustering using Grown Neural Gas algorithm. I couldn't
 find any information on PyMVPA. MDP offers growing neural gas class but it
 is not implemented for fMRI data. anyone has any idea either finding a good
 nerual gas python tool or modyfying the existing tool so it can be applied
 to fMRI time course data.
 Any suggestions?
 Thanks,
 Tony

 ___
 Pkg-ExpPsy-PyMVPA mailing list
 Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org
 http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa


___
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa


Re: [pymvpa] PyMVPA for Python 3 -- second report

2012-04-22 Thread Tiziano Zito
 was it painful?
not really, just a bit of vi gymnastics ;)

ciao,
tiziano

___
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa


Re: [pymvpa] PyMVPA for Python 3 -- second report

2012-04-21 Thread Tiziano Zito
 may be some skype/shared screen
 sprintee next week over remaining issues etc?

yes, if michael is around we could meet in berlin or magdeburg and
have get you on skype. 

 There is a bulk of changes in some guys feature branches and if we do not
 merge now, later it might not be as easy ;) I guess I would also need to check
 how changes affect minimal compatible version in 2.x series (if affect at 
 all).
 FWIC (for what i care) 2.6 should be good enough for me ;)

I have tried to stay compatible with 2.5 so that you can backport to
squeeze, but I did not test if this is really the case.

 but at times going through changes I got a bit scared ;-) e.g.

that is the most controversial change, I think:

 1.
 -self._unique_values = np.unique(self.value)
 +# get a 1-D array
 +arrvalue = np.asarray(self.value).ravel()
 +# check if we have None somewhere
 +nones = np.equal(arrvalue, None)
 +if nones.any():
 +uniques = np.unique(arrvalue[nones == False])
 +# put back one None
 +self._unique_values = np.insert(uniques, 0, None)
 +else:
 +self._unique_values = np.unique(arrvalue)
 
 does numpy  handles its own arrays differently among pythons or what is
 the reason?

the reason is that sometimes self.values contains None's. in python
3 arithmetic comparisons like  or  are not allowed among
heterogeneous types, so you can not sort a list or an array that
looks for example like this: [ 0, 1, None, -2]. and np.unique uses
sort internally. the dance with the None's is not needed in py2, so
we could special case with a sys.version = '3', but you have to
decide if it is worth it. the new masked array type in newcoming
numpy could probably used instead...

it is not an inferior behaviour when compared to py2: actually I
think I spotted at least one place (the tests is still failing)
where PyMVPA was comparing non-comparable types and getting a
basically random result:

==
ERROR: test_basic (mvpa2.tests.test_datameasure.SensitivityAnalysersTests)
--
Traceback (most recent call last):
  File /home/tiziano/git/PyMVPA/build/py3k/mvpa2/testing/sweepargs.py, line 67
, in do_sweep
method(*args_, **kwargs_)
  File /home/tiziano/git/PyMVPA/build/py3k/mvpa2/tests/test_datameasure.py, li
ne 79, in test_basic
self.assertTrue(f[0]  0.1) # some reasonably large value
TypeError: unorderable types: Dataset()  float()

 2.
 -sample += random.sample((targets == r).nonzero()[0], npertarget[i] )
 +sample += random.sample(list((targets == r).nonzero()[0]), 
 npertarget[i] )
 
 why does it need explicit conversion to list, are numpy arrays not
 iterables any longer, or random.sample now can't tollerate them...

the reason is:

Python 3.2.3rc2 (default, Mar 21 2012, 05:47:04) 
[GCC 4.6.3] on linux2
Type help, copyright, credits or license for more information.
 import numpy
 x = numpy.zeros((10,))
 import random
 random.sample(x, 1)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python3.2/random.py, line 298, in sample
raise TypeError(Population must be a sequence or set.  For dicts, use 
list(d).)
TypeError: Population must be a sequence or set.  For dicts, use list(d).
 

I do not know why numpy arrays are not sequences in py3, but this is
it.

 +Convert *py files with lib2to3.
 +Taken from MDP and numpy.
 
 so -- copyright of numpy and MDP developers? years? (BSD-3 I guess ;) )

will do :)

ciao,
tiziano


___
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa


Re: [pymvpa] PyMVPA for Python 3 -- second report

2012-04-21 Thread Tiziano Zito

 cool -- you can consider me now a contributor to this little project
 ;-) I have sent a pull request against your branch with few
 changes, please review.

I merged your pull request, thank you :)

 Also it might be nice to markup those commits which deal with python3
 compatibility as PY3 (e.g. instead of BF), not sure if it is worth
 rewriting the history for this cause though :-)  but might be good to
 start at least now

that's a good idea. I fear my git foo stops at git rebase -i, to
do what you want we would need a git filter-branch, right? 
I would prefer to rewrite history, if you give me a couple of hints
on how to do it properly. 

ciao,
tiziano


___
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa


[pymvpa] PyMVPA for Python 3 -- second report

2012-04-20 Thread Tiziano Zito
hi all,

with my today's efforts I got down to 13 errors and 15 failures out
of 284 tests, so it's getting better :) 
on the same branch the same set of unittests passes without errors
or failures with python 2.7, so I assume I did not break anything
important. 

I attach here the error logs in case someone else feels like having
a look. 

the remaining errors and failures are probably out of my reach, as
fixing them requires a much deeper understanding of the very rich
data types structure of PyMVPA ;) I am available for a short sprint
in case someone is orbiting around northern germany...

there are some commits that I think would require a deeper review by
some core developer, as I am not 100% sure those changes are really
as neutral as the lack of failures in the unittests seems to suggest.

I had to disable a test that was hanging in an infinite loop:
test_nfold_random_counted_selection_partitioner
no idea what the problem there is, really.

one point where I can directly ask for a solution is the usage of
the variable nproc in BaseSearchlight (mvpa2/measures/searchlight.py):
the doc-string seems to imply that setting it to None would use all
available cores, but if the pprocess module is not installed this is
not true, and an error is spit only in the case nproc  1
(which is false if nproc is None). so maybe the doc-string could be
updated to say something like:

nproc : None or int
How many processes to use for computation.  Requires `pprocess`
external module.  If None -- all available cores will be used 
if `pprocess` is available, a single core will be used otherwise.


ciao,
tiziano



python3 setup.py config --noisy
Converting to Python3 via 2to3...
running config
python3 setup.py build_ext --inplace
Converting to Python3 via 2to3...
running build_ext
running build_src
build_src
building extension mvpa2.clfs.libsmlrc.smlrc sources
building extension mvpa2.clfs.libsvmc._svmc sources
building data_files sources
build_src: building npy-pkg config files
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
running scons
touch build3-stamp
I: Running py3-compatible unittests. None of them should ever fail.
T: MVPA_SEED=1251509818
T: Testing for availability of external software packages.
WARNING: libsvm verbosity control is not available.
 * Please note: warnings are printed only once, but underlying problem might 
occur many times *
test_externals (mvpa2.tests.test_externals.TestExternals) ... ok
test_externals_correct2nd_invocation (mvpa2.tests.test_externals.TestExternals) 
... ok
test_externals_no_double_invocation (mvpa2.tests.test_externals.TestExternals) 
... ok
test_basic (mvpa2.tests.test_dochelpers.DochelpersTests) ... ok
test_borrow_doc (mvpa2.tests.test_dochelpers.DochelpersTests) ... ok
test_borrow_kwargs (mvpa2.tests.test_dochelpers.DochelpersTests) ... ok
test_searchlight_doc (mvpa2.tests.test_dochelpers.DochelpersTests) ... ok
test_simple_som (mvpa2.tests.test_som.SOMMapperTests) ... ERROR
test_blank_state (mvpa2.tests.test_state.StateTests) ... ok
test_deep_copying_state_variable (mvpa2.tests.test_state.StateTests) ... ok
Check if we can store/restore set of enabled ca ... ok
test_parametrized (mvpa2.tests.test_state.StateTests) ... ERROR
test_proper_state (mvpa2.tests.test_state.StateTests) ... ok
Simple test if child gets conditional attributes from the parent as well ... ok
test_read_only (mvpa2.tests.test_state.StateTests) ... ok
To test new ca ... ok
test_stored_temporarily (mvpa2.tests.test_state.StateTests) ... ok
test_value_in_constructor (mvpa2.tests.test_state.StateTests) ... ok
test_blank (mvpa2.tests.test_params.ParamsTests) ... ok
test_classifier (mvpa2.tests.test_params.ParamsTests) ... ok
test_incorrect_parameter_error (mvpa2.tests.test_params.ParamsTests) ... ok
test_mixed (mvpa2.tests.test_params.ParamsTests) ... ok
test_simple (mvpa2.tests.test_params.ParamsTests) ... ok
test_config (mvpa2.tests.test_config.ConfigTests) ... ok
test_asobjarray (mvpa2.tests.test_support.SupportFxTests) ... ok
test_break_points (mvpa2.tests.test_support.SupportFxTests) ... ok
test_correlation (mvpa2.tests.test_support.SupportFxTests) ... ok
test_event (mvpa2.tests.test_support.SupportFxTests) ... ok
test_id_hash (mvpa2.tests.test_support.SupportFxTests) ... FAIL
test_map_overlap (mvpa2.tests.test_support.SupportFxTests) ... ok
test_mof_n_combinations (mvpa2.tests.test_support.SupportFxTests) ... ok
Test our ad-hoc SmartVersion ... ERROR
test_transform_with_boxcar (mvpa2.tests.test_support.SupportFxTests) ... ok
Test conversion of versions from strings ... ok
test_xrandom_unique_combinations (mvpa2.tests.test_support.SupportFxTests) ... 
ok
mvpa2.tests.test_support.test_value2idx ... ok
mvpa2.tests.test_support.test_limit_filter ... ok
Test if works fine with carriage return (cr) symbol ... ok
test_debug (mvpa2.tests.test_verbosity.VerboseOutputTest) ... ok
test_debug_rgexp 

Re: [pymvpa] PyMVPA for Python 3

2012-04-19 Thread Tiziano Zito
 if you push your work somewhere (I don't see your clone at
 https://github.com/PyMVPA/PyMVPA/network) we will add it to daily
 testing

I don't know why you don't see it, but I do have a fork on github:
https://github.com/otizonaizit/PyMVPA/

but please, slow down, this is very much work in progress and it is
by no means ready to be daily tested by anyone who is not me ;)
most quick tests are failing anyway *and* I want to be free to
rewrite history a bit before having other people pulling from it... 

 MVPA_TESTS_QUICK=yes 
 
 for the final test run since that would exclude looping over
 parameters in many parametric tests, and just run on the first
 argument only, thus not exploring as much

fair enough. I'll remember to switch it off again as soon as my py3
port starts passing the quick tests.


 MVPA_MATPLOTLIB_BACKEND=agg

 would it help?

yes, it is helping already.

 P.S. Meanwhile I will upgrade our testing box and will setup everything
 we have for python3 so far ;)

whichis ATM, I fear, only python3-numpy and python3-mdp...

I hope python3-scipy and python3-matplotlib make it in time for
wheezy, but given the amount of nit-picking going on on
python-debian ML, I fear we may be stuck without a proper py3
environment in debian for another couple of years...

ciao,
tiziano


___
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa


Re: [pymvpa] PyMVPA for Python 3 -- first report

2012-04-19 Thread Tiziano Zito
 My guess is that it is still related to how that AttributesCollector
 injects those additional attributes into the freshly constructed
 classes.  I hope above clues would be of help

it helped indeed ;)

ciao,
tiziano


___
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa


Re: [pymvpa] PyMVPA for Python 3

2012-04-18 Thread Tiziano Zito
 MVPA_TESTS_QUICK=yes MVPA_TESTS_LOWMEM=yes make unittest-nonlabile
 [...]
 
 Let us know if that helps for a start.

yep, it works fine this way, thanks. it even finds more unit tests (326) ;)

ciao,
tiziano


___
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa