Dear Roberto,
thank you very much for your reply!
I have tried adding a line as you suggested, but nothing changed.
Actually, I thought from the PyMVPA manual that it is the
'RepeatedMeasure(sensanasvm, NFoldPartitioner())' that takes care of the
cross-validation.
I have now tried modifying my code to make it more more similar to the example
in the RFE help documentation, with two different outcomes:
1) The following is basically equivalent to the snippet I sent previously and,
at least in my intentions, modelled upon the sensitivity analysis with feature
selection.
With this, I still get the error message "RuntimeError: Cannot reverse-map data
since the original data shape is unknown. Either set `dshape` in the
constructor, or call train()."
#-----------------------------
clfsvm = SplitClassifier(LinearCSVMC(), NFoldPartitioner())
rfesvm = RFE(clfsvm.get_sensitivity_analyzer(postproc=maxofabs_sample()),
ConfusionBasedError(clfsvm, confusion_state='stats'), Repeater(2),
fselector=FractionTailSelector(0.30, mode='select', tail='upper'),
stopping_criterion=NBackHistoryStopCrit(BestDetector(), 10),
train_pmeasure=False, update_sensitivity=True)
fclfsvm = FeatureSelectionClassifier(clfsvm, rfesvm)
sensanasvm = fclfsvm.get_sensitivity_analyzer(postproc=maxofabs_sample())
cv_sensana_svm = RepeatedMeasure(sensanasvm, NFoldPartitioner())
senssvm = cv_sensana_svm(fds)
print senssvm.shape
#-----------------------------
2) I have also tried a different solution, which however I do not think that is
suited to produce a sensitivity map. The following does not yield any errors and
produces the correct map dimensionality. However, not suprisingly, the result
does not make any sense, as I get a uniform value spread across all brain mask
voxels.
#-----------------------------
clfsvm = SplitClassifier(LinearCSVMC(), NFoldPartitioner())
rfesvm = RFE(clfsvm.get_sensitivity_analyzer(postproc=maxofabs_sample()),
ConfusionBasedError(clfsvm, confusion_state='stats'), Repeater(2),
fselector=FractionTailSelector(0.30, mode='select', tail='upper'),
stopping_criterion=NBackHistoryStopCrit(BestDetector(), 10),
train_pmeasure=False, update_sensitivity=True)
fclfsvm = FeatureSelectionClassifier(clfsvm, rfesvm)
cvtesvm = CrossValidation(fclfsvm, NFoldPartitioner(), errorfx=lambda p,
t:np.mean(p == t), postproc=maxofabs_sample(), enable_ca=['confusion', 'stats'])
cv_sensana_svm = RepeatedMeasure(cvtesvm, NFoldPartitioner())
senssvm = cv_sensana_svm(fds)
#-----------------------------
Thank you all and very best wishes,
Marco
Date: Fri, 12 Jul 2013 11:36:21 +0200
From: Roberto Guidotti<[email protected]>
To: Development and support of PyMVPA
<[email protected]>
Subject: Re: [pymvpa] Sensitivity map with RFE?
Message-ID:
<cagj93chsqy-sqxe7h7ywp4tgncevbhw7ypsx8ennf6fwlrk...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Dear Marco,
From your snippet I notice that you get the sensitivity analyzer without
run any CrossValidation/Classification.
So try to run
-------
err = fclfsvm(fds) #That let you to cross validate/classify/select features
on your dataset
-------
This let you to train your object and then you can get the sensitivity of
your classifier.
I've never used RFE, but this is what I get by your snippet.
Ciao
Roberto
> Dear all,
> is there any manner to obtain a sensitivity map with RFE, similar to what
> can be done with feature selection?
>
> I am trying to use the following code:
>
> #-----------------------------**--------------------
> clfsvm = LinearCSVMC()
>
> rfesvm = RFE(clfsvm.get_sensitivity_**analyzer(postproc=maxofabs_**sample()),
> CrossValidation(clfsvm, NFoldPartitioner(), errorfx=mean_mismatch_error,
> postproc=mean_sample()), Repeater(2), fselector=**FractionTailSelector(0.30,
> mode='select', tail='upper'),
stopping_criterion=**NBackHistoryStopCrit(**BestDetector(),
> 10), update_sensitivity=True)
>
> fclfsvm = FeatureSelectionClassifier(**clfsvm, rfesvm)
>
> sensanasvm = fclfsvm.get_sensitivity_**analyzer(postproc=maxofabs_**
> sample())
>
> cv_sensana_svm = RepeatedMeasure(sensanasvm, NFoldPartitioner())
>
> senssvm = cv_sensana_svm(fds)
> #-----------------------------**--------------------
>
> However, after a while I get the following error:
>
> RuntimeError: Cannot reverse-map data since the original data shape is
> unknown. Either set `dshape` in the constructor, or call train().
>
>
> Thank you in advance for any help!
> Best wishes,
> Marco
--
Marco Tettamanti, Ph.D.
Nuclear Medicine Department & Division of Neuroscience
San Raffaele Scientific Institute
Via Olgettina 58
I-20132 Milano, Italy
Phone ++39-02-26434888
Fax ++39-02-26434892
Email: [email protected]
Skype: mtettamanti
--------------------------------------------------------------------------
LA TUA CURA E' SCRITTA NEL TUO DNA. AL SAN RAFFAELE LA STIAMO REALIZZANDO.
AIUTA LA RICERCA, DAI IL TUO 5XMILLE - CF: 07636600962
info:[email protected] - www.5xmille.org
Disclaimer added by CodeTwo Exchange Rules 2007
http://www.codetwo.com
_______________________________________________
Pkg-ExpPsy-PyMVPA mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa