def get_cv_error(clf,feats,scores):
results={'<STR_LIT:success>' : False, '<STR_LIT>' : <NUM_LIT:0>, '<STR_LIT>' : <NUM_LIT:0>}<EOL>try:<EOL><INDENT>cv_preds=util_functions.gen_cv_preds(clf,feats,scores)<EOL>err=numpy.mean(numpy.abs(numpy.array(cv_preds)-scores))<EOL>kappa=util_functions.quadratic_weighted_kappa(list(cv_preds),scores)<EOL>results['<STR_LIT>']=err<EOL>results['<STR_LIT>']=kappa<EOL>results['<STR_LIT:success>']=True<EOL><DEDENT>except ValueError as ex:<EOL><INDENT>msg = u"<STR_LIT>".format(ex=ex)<EOL>log.debug(msg)<EOL><DEDENT>except:<EOL><INDENT>log.exception("<STR_LIT>")<EOL><DEDENT>return results<EOL>
Gets cross validated error for a given classifier, set of features, and scores
clf - classifier
feats - features to feed into the classified and cross validate over
scores - scores associated with the features -- feature row 1 associates with score 1, etc.