Multivariate Pattern Analysis in Python

### Navigation

- index
- modules |
- modules |
- previous |
- PyMVPA Home |
- Sitemap »
- PyMVPA User Manual »
- Miscellaneous »
- mvpa2.misc.neighborhood »

# mvpa2.misc.neighborhood.CachedQueryEngine

class `mvpa2.misc.neighborhood.``CachedQueryEngine`(queryengine)

  Provides caching facility for query engines.

  Notes

  This QueryEngine simply remembers the results of the previous queries. Not much checking is done on either datasets it gets in `train()` is the same as the on in previous sweep of queries, i.e. either none of the relevant for underlying QueryEngine feature attributes was modified. So, CAUTION should be paid to avoid calling the same instance of `CachedQueryEngine` on different datasets (which might have different masking etc) .

  `query_byid()` should be working reliably and without surprises.

  `query()` relies on hashid of the queries, so there might be a collision! Thus consider it EXPERIMENTAL for now.

  Methods

  `query`(**kwargs) | Return feature ids of neighbors given a specific query
  `query_byid`(fid) | Return feature ids of neighbors for a given feature id
  `train`(dataset) | ‘Train’ `CachedQueryEngine`.
  `untrain`() | Forgetting that CachedQueryEngine was already trained

  Parameters:

  queryengine : QueryEngine

  > Results of which engine to cache

  Methods

  `query`(**kwargs) | Return feature ids of neighbors given a specific query
  `query_byid`(fid) | Return feature ids of neighbors for a given feature id
  `train`(dataset) | ‘Train’ `CachedQueryEngine`.
  `untrain`() | Forgetting that CachedQueryEngine was already trained

  `query`(**kwargs)

    Return feature ids of neighbors given a specific query

  `query_byid`(fid)

    Return feature ids of neighbors for a given feature id

  `queryengine`
  `train`(dataset)

    ‘Train’ `CachedQueryEngine`.

    Raises:

    ValueError :

    > If `dataset`‘s .fa were changed – it would raise an exception telling to `untrain` explicitly, since the idea is to reuse CachedQueryEngine with the same engine and same dataset (up to variation of .sa, such as labels permutation

  `untrain`()

    Forgetting that CachedQueryEngine was already trained

### Navigation

- index
- modules |
- modules |
- previous |
- PyMVPA Home |
- Sitemap »
- PyMVPA User Manual »
- Miscellaneous »
- mvpa2.misc.neighborhood »