Issue With Cross_validation In Pandas_ml

I try to complete cross validation with pandas_ml library

df = pdml.ModelFrame(features, target)
estimators = {'SVM: SVR': df.svm.SVR(),
              'SVM: LinearSVR': df.svm.LinearSVR()}

for label, estimator in estimators.iteritems():
    scores = df.cross_validation.cross_val_score(estimator=estimator, cv=7, scoring='accuracy')
    print("Accuracy: %0.2f (+/- %0.2f) [%s]" % (scores.mean(), scores.std(), label))

However, I got unexpected error

raise ValueError("{0} is not supported".format(y_type))

ValueError: continuous is not supported

Any tricks here?



This is because the accuracy metric is for scoring classification models only. It measures the fraction of correct predictions. Instead of what fraction of your predictions are correct, in regression what you want to know is how far away from the correct answer your predictions are - it's unlikely that any of them will be exactly correct so that's not a meaningful metric.

Regression metrics include r2, mean_squared_error, mean_absolute_error, etc.

You could use something like:

scores = df.cross_validation.cross_val_score(estimator=estimator, cv=7, scoring='r2')