[pymvpa] extracting sample predictions from a searchlight

Brian Murphy brian.murphy at qub.ac.uk
Wed Apr 6 18:05:20 UTC 2016


Hi again,

> those return just samples which would be predicted labels... what could
> be the "mean" of them? ;)  just disable postproc for now to see if you
> are getting what you wanted first

Great - that does give me the the set of individual predictions for each
sample trial, for each of the searchlight locations run (see snippet
again below). I'll start testing this version at a larger scale. 

BTW the times that I tried setting errorfx to a custom function of
format blah(predictions, targets) still threw an error - but as you
suggest even if I got that to work it wouldn't give me access to any
more information that what I have now. To get deeper classifier stats
for each searchlight (e.g. the PLR probabilities that drive the
predictions) I would need access to the CrossValidation object itself -
ie cv.ca.stats.sets[p][2].

thanks!

Brian

# WORKING SNIPPET
>     ...: searchLightSize = 3
>     ...: clf = PLR();
>     ...: cv = CrossValidation(clf, 
>     ...: 	NFoldPartitioner(),
>     ...: 	errorfx=None,
>     ...: 	enable_ca=['probabilities', 'samples_error','stats', 'calling_time','confusion', 'estimates', 'predictions', 'repetition_results', 'raw_results', 'null_prob']
>     ...: )
>     ...: sl = sphere_searchlight(cv, radius=searchLightSize, postproc=None) 
>     ...: sl_map = sl(miniDs)
>     ...: print sl_map.shape
>     ...: print sl_map
> 
> [SLC] DBG:                            Starting off 4 child processes for nblocks=4
> 
> [SLC] DBG:                                  Starting computing block for 3 elements
> [SLC] DBG:                                  Starting computing block for 3 elements
> [SLC] DBG:                                  Starting computing block for 2 elements
> [SLC] DBG:                                  Starting computing block for 2 elements
> [SLC] DBG:                                  +0:00:00 ======[100%]====== 0:00:00  ROI 6 (3/3), 10 features 
> 
> 
> 
> [SLC] DBG:                              hstacking 10 results of shape (462, 1)
> [SLC] DBG:                              hstacked shape (462, 10)
> (462, 10)
> <Dataset: 462x10@|S7, <sa: cvfolds,targets>, <fa: center_ids>, <a: mapper>>
> 
> sl_map
> Out[100]: 
> Dataset(array([['subject', 'subject', 'subject', ..., 'subject', 'subject',
>         'subject'],
>        ['subject', 'subject', 'subject', ..., 'subject', 'subject',
>         'subject'],
>        ['subject', 'subject', 'subject', ..., 'subject', 'subject',
>         'subject'],
>        ..., 
>        ['subject', 'subject', 'subject', ..., 'subject', 'subject',
>         'subject'],
>        ['subject', 'subject', 'subject', ..., 'subject', 'subject',
>         'subject'],
>        ['subject', 'subject', 'subject', ..., 'subject', 'subject',
>         'subject']], 
>       dtype='|S7'), sa=SampleAttributesCollection(items=[ArrayCollectable(name='targets', doc=None, value=array(['subject', 'object', 'subject', 'subject', 'subject', 'object',
>        'subject', 'subject', 'subject', 'subject', 'subject', 'object',
>        'object', 'object', 'subject', 'subject', 'subject', 'object',
>        'subject', 'object', 'subject', 'subject', 'object', 'subject',
>        'subject', 'subject', 'subject', 'subject', 'object', 'subject',
>        'subject', 'object', 'subject', 'subject', 'object', 'object',
>    
> 




More information about the Pkg-ExpPsy-PyMVPA mailing list