[pymvpa] cross-validation & regression analysis

Matthias Ekman Matthias.Ekman at nf.mpg.de
Thu Apr 8 22:15:23 UTC 2010


Hi,

I just started to figure out how SVM for 'regression' is implemented in 
PyMVPA/libsvm. In comparison to SVM for 'classification' I am not 
interested in the classification accuracy but in the explained variance.

Setting up cross-validation for 'classification' is easy like:

clf = LinearCSVMC()
splitter = NFoldSplitter(cvtype=1)
cv = CrossValidatedTransferError(
		TransferError(clf),
		splitter)


However, here is my code for 'regression':

clf = SVM(kernel_type='sigmoid', svm_impl='EPSILON_SVR', regression=True)	

dets=[]

for nfold, (training_ds, validation_ds) in enumerate(splitter(dataset)):	
			clf.train(training_ds)
			prediction = clf.predict(validation_ds.samples)
	
			r = corrcoef(prediction, validation_ds.labels)
			det_coef = r[1][0]**2
			dets.append(det_coef)
		
mean_det_coef=mean(array(dets))

I was wondering if there is smth equivalent to 
"CrossValidatedTransferError" for regression?

Thanks,
  Matthias



More information about the Pkg-ExpPsy-PyMVPA mailing list