[pymvpa] Construct custom queryengine with dict
Swaroop Guntupalli
swaroopgj at gmail.com
Wed Feb 15 00:03:18 UTC 2017
Never mind. Figured it out
Just for documenting:
I needed to change instantiating qe to this
qe = IndexQueryEngine(testid=testdict.get)
Thanks,
Swaroop
On Tue, Feb 14, 2017 at 12:39 PM, Swaroop Guntupalli <swaroopgj at gmail.com>
wrote:
> Hi,
>
> I am trying to make a QueryEngine() with a custom dict which takes in some
> id and returns neighborhood. So, far I have failed. I am pasting my attempt
> below. Any help would be appreciated.
>
> Thanks,
> Swaroop
>
> ##
> # custom dict that has feature ids as keys and neighborhood as values
> testdict = {i: range(i) for i in range(10)}
> qe = IndexQueryEngine(testid=testdict)
>
>
> # fake dataset
> fake_ds = Dataset(samples=np.random.rand(5, 10), fa={'testid': range(10)})
>
> # training
> qe.train(fake_ds)
>
> # this works fine
> print qe.ids
>
> # this line below fails with TypeError: 'dict' object is not callable
> # in line#572 in mvpa2/misc/neighborhood.py
> qe[0]
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20170214/22f46c81/attachment.html>
More information about the Pkg-ExpPsy-PyMVPA
mailing list