[pymvpa] problem running LARS (via rpy)
Yaroslav Halchenko
debian at onerussian.com
Thu Aug 27 19:24:01 UTC 2009
I am sorry to give a lame response, but could you try with a big newer
R? I have
In [5]:rpy.RVER
Out[6]:'2091'
In [7]:rpy.RVERSION
Out[8]:'2.9.1'
# !!! this one is wrong ;) see below
In [4]:rpy.__version__
Out[4]:'1.2.1'
LARS is 0.9-7-1cran1 as in the debian package from cran2deb repository
and your little snippet works...
d'oh, rpy.__version__ is not actually version of rpy (surprise!) but of numpy
(enjoy "import *");)
In [12]:rpy.rpy_version
Out[14]:'1.0.3'
btw -- little Python hint, no need for '\' to signal for continuation on
the next line if you are within parenthesis (like among the arguments to the
function, or just a tuple).
On Wed, 26 Aug 2009, Epic John wrote:
> Hi All,
> I was really happy to find pymvpa a few days ago. I like some of the
> dataset/classifier abstractions that are present, and while I haven't
> explored the entire package yet, I am eager to start using it more.
> I ran into a problem running LARS, however (which was the original
> reason I looked into pymvpa.) Part of this might stem from my relative
> lack of knowledge of R/rpy, but I thought I should ask for some help
> here.
> I am doing something really basic:
> training = Dataset(samples=N.array( N.arange(100),ndmin=2,
> dtype='float').T,\
> labels=[0] * 50 + [1] * 50)
> lrs = LARS()
> lrs.train(training)
> That fails with an rpy exception, which basically tells me there is
> something wrong with the types. I see we are passing a python ndarray
> as the 'x' argument of lars, which I am guessing is supposed to be
> converted
> to an R matrix behind the scenes. At the end something bad happens when
> the lars code invokes 'dim(x)'. I am using R 2.7.0, rpy-1.0.3. I have
> been able to do basic things with rpy, such as plotting, which tells me
> my rpy/R installation is fine. I have pasted the excetion I get at the
> end of the email.
> Does anyone have any idea how to get LARS to work?
> Thanks
> EJ
> C:\Python25\lib\site-packages\mvpa\clfs\base.pyc in train(self,
> dataset)
> 352
> 353 if dataset.nfeatures > 0:
> --> 354 result = self._train(dataset)
> 355 else:
> 356 warning("Trying to train on dataset with no
> features present")
> C:\Python25\lib\site-packages\mvpa\clfs\lars.pyc in _train(self, data)
> 145
> intercept=self.__intercept,
> 146
> trace=self.__trace,
> --> 147
> use_Gram=self.__use_Gram)
> 148 else:
> 149 # train with specifying max_steps
> RPy_RException: Error in rep(1, n) : invalid 'times' argument
> WARNING: Failure executing file: <mvpa_test.py>
> _______________________________________________
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pymvpa
--
.-.
=------------------------------ /v\ ----------------------------=
Keep in touch // \\ (yoh@|www.)onerussian.com
Yaroslav Halchenko /( )\ ICQ#: 60653192
Linux User ^^-^^ [175555]
More information about the Pkg-ExpPsy-PyMVPA
mailing list