Regression confidence using SVMs in python

旧城冷巷雨未停 提交于 2019-12-10 11:43:19

问题


I'm using regression SVMs in python and I am wondering if there is any way to get a "confidence-measure" value for its predictions.

Previously, when using SVMs for binary classification, I was able to compute a confidence-type value from the 'margin'. Here is some pseudo-code showing how I got a confidence value:

# Begin pseudo-code
import svm as svmlib

prob = svmlib.svm_problem(labels, data)
param = svmlib.svm_parameter(svm_type=svmlib.C_SVC, kernel_type = svmlib.RBF)
model = svmlib.svm_model(prob, param)

# get confidence
confidence = self.model.predict_values_raw(sample_to_classify)

I imagine that the further the new sample is from the training data, the worse the confidence, but I'm looking for a function that might help compute a reasonable estimate for this.

My (high-level) problem is as follows:

  • I have a function F(x), where x is a high-dimensional vector
  • F(x) can be computed but it is very slow
  • I want to train a regression SVM to approximate it
  • If I can find values of 'x' that have low prediction confidence, I can add these points and retrain (aka. active learning)

Has anyone obtained/used regression-SVM confidence/margin values before?


回答1:


Have a look at this similar response on Stack back in January. The chosen answer was spot on regarding how hard it is to get confidence measures on non-parametric fitting methods. There's probably some Bayesian type thing you could do, but that's probably not possible with the Python SVM library: Prefer one class in libsvm (python).



来源:https://stackoverflow.com/questions/5148168/regression-confidence-using-svms-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!