Skip to content
Snippets Groups Projects
Commit 5cb55123 authored by Vincent Michel's avatar Vincent Michel
Browse files

Add coef_ to SVR.

git-svn-id: https://scikit-learn.svn.sourceforge.net/svnroot/scikit-learn/trunk@708 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8
parent 1caffe80
No related branches found
No related tags found
No related merge requests found
......@@ -235,6 +235,20 @@ class SVR(BaseLibsvm):
cache_size, eps, C, nr_weight, nu, p,
shrinking, probability)
@property
def coef_(self):
if _kernel_types[self.kernel] != 'linear':
raise NotImplementedError(
'coef_ is only available when using a linear kernel')
if self.support_.size == 0:
raise Exception, 'No support vector'
coef_ = []
for i in range(self.dual_coef_.shape[0]):
coef_.append(np.dot(self.dual_coef_[i], self.support_))
coef_ = np.array(coef_)
return coef_
class OneClassSVM(BaseLibsvm):
"""
Outlayer detection
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment