8000 patches to svdd-l1 reflecting #14286, #16530, #16992 and #16973 · ivannz/scikit-learn@dc9380d · GitHub
[go: up one dir, main page]

Skip to content

Commit dc9380d

Browse files
committed
1 parent d4c7bab commit dc9380d

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

sklearn/svm/_classes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,7 @@ class SVDD(OutlierMixin, BaseLibSVM):
18301830
>>> clf = SVDD(gamma='auto').fit(X)
18311831
>>> clf.predict(X)
18321832
array([-1, 1, 1, 1, -1])
1833-
>>> clf.score_samples(X) # doctest: +ELLIPSIS
1833+
>>> clf.score_samples(X)
18341834
array([0.5298..., 0.8047..., 0.8056..., 0.8061..., 0.4832...])
18351835
18361836
References
@@ -1847,7 +1847,7 @@ class SVDD(OutlierMixin, BaseLibSVM):
18471847

18481848
_impl = 'svdd_l1'
18491849

1850-
def __init__(self, kernel 8000 ='rbf', degree=3, gamma='scale',
1850+
def __init__(self, *, kernel='rbf', degree=3, gamma='scale',
18511851
coef0=0.0, tol=1e-3, nu=0.5, shrinking=True, cache_size=200,
18521852
verbose=False, max_iter=-1):
18531853

sklearn/svm/src/libsvm/svm.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,14 +1840,14 @@ static void solve_nu_svr(
18401840

18411841
static void solve_svdd_l1(
18421842
const PREFIX(problem) *prob, const svm_parameter *param,
1843-
double *alpha, Solver::SolutionInfo* si)
1843+
double *alpha, Solver::SolutionInfo* si, BlasFunctions *blas_functions)
18441844
{
18451845
int l = prob->l;
18461846
int i, j;
18471847

18481848
double r_square;
18491849

1850-
ONE_CLASS_Q Q = ONE_CLASS_Q(*prob, *param);
1850+
ONE_CLASS_Q Q = ONE_CLASS_Q(*prob, *param, blas_functions);
18511851

18521852
if(param->nu < 1) {
18531853
// case \nu < 1: the dual problem is
@@ -1990,7 +1990,7 @@ static decision_function svm_train_one(
19901990
break;
19911991
case SVDD_L1:
19921992
si.upper_bound = Malloc(double,prob->l);
1993-
solve_svdd_l1(prob,param,alpha,&si);
1993+
solve_svdd_l1(prob,param,alpha,&si,blas_functions);
19941994
break;
19951995
}
19961996

@@ -2945,7 +2945,7 @@ double PREFIX(predict_values)(const PREFIX(model) *model, const PREFIX(node) *x,
29452945

29462946
if(model->param.svm_type == SVDD_L1)
29472947
{
2948-
double K_xx = NAMESPACE::Kernel::k_function(x,x,model->param) / 2;
2948+
double K_xx = NAMESPACE::Kernel::k_function(x,x,model->param,blas_functions) / 2;
29492949
for(int i=0;i<model->l;i++)
29502950
sum -= sv_coef[i] * K_xx;
29512951
}
@@ -3266,7 +3266,8 @@ const char *PREFIX(check_parameter)(const PREFIX(problem) *prob, const svm_param
32663266
if(svm_type == C_SVC ||
32673267
svm_type == EPSILON_SVR ||
32683268
svm_type == NU_SVR ||
3269-
svm_type == ONE_CLASS)
3269+
svm_type == ONE_CLASS ||
3270+
svm_type == SVDD_L1)
32703271
{
32713272
PREFIX(problem) newprob;
32723273
// filter samples with negative and null weights

0 commit comments

Comments
 (0)
0