[pymvpa] RFE question 2.0
James M. Hughes
James.M.Hughes at Dartmouth.edu
Mon Nov 17 17:09:48 UTC 2008
Sorry to spam the list, but is is possible that there's a problem
using RFE w/ CrossValidatedTransferError?
Here's some code I'm attemping to run:
rfesvm_split = LinearCSVMC()
FeatureSelection =
RFE(sensitivity_analyzer=rfesvm_split.getSensitivityAnalyzer(),
transfer_error=TransferError(rfesvm_split), \
feature_selector=FractionTailSelector(percent / 100.0,
mode='select', tail='upper'), update_sensitivity=True)
clf = FeatureSelectionClassifier(clf = LinearCSVMC(), \
# on features selected via RFE
feature_selection = FeatureSelection)
# update sensitivity at each step (since we're not using the
same CLF as sensitivity analyzer)
clf.states.enable('feature_ids')
cv = CrossValidatedTransferError(TransferError(clf),
NFoldSplitter(cvtype=1), enable_states=['confusion'])
error = cv(dataset)
print 'Error: ' + `error`
return clf.confusion, clf.feature_ids
where dataset and percent are input arguments...
I get the following error (somewhere pretty far down the call stack):
1060
-> 1061 predictions = self.clf.predict(testdataset.samples)
predictions = undefined
self.clf.predict = <bound method LinearCSVMC.predict of
LinearCSVMC(kernel_type='linear', svm_impl='C_SVC')>
testdataset.samples = undefined
1062
1063 # compute confusion matrix
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute
'samples'
It seems like the testdataset argument, which is typically empty, in
the FeatureSelectionClassifier is somehow not getting set correctly.
I thought the splitter in CrossValidatedTransferError would take care
of this.
Am I missing something big here?
Thanks for any help!
Cheers,
James.
More information about the Pkg-ExpPsy-PyMVPA
mailing list