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

Skip to content

Commit 38f918d

Browse files
committed
1 parent acb2920 commit 38f918d

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
@@ -1556,7 +1556,7 @@ class SVDD(OutlierMixin, BaseLibSVM):
15561556
>>> clf = SVDD(gamma='auto').fit(X)
15571557
>>> clf.predict(X)
15581558
array([-1, 1, 1, 1, -1])
1559-
>>> clf.score_samples(X) # doctest: +ELLIPSIS
1559+
>>> clf.score_samples(X)
15601560
array([0.5298..., 0.8047..., 0.8056..., 0.8061..., 0.4832...])
15611561
15621562
References
@@ -1573,7 +1573,7 @@ class SVDD(OutlierMixin, BaseLibSVM):
15731573

15741574
_impl = 'svdd_l1'
15751575

1576-
def __init__(self, kernel='rbf', degree=3, gamma='scale',
1576+
def __init__(self, *, kernel='rbf', degree=3, gamma='scale',
15771577
coef0=0.0, tol=1e-3, nu=0.5, shrinking=True, cache_size=200,
15781578
verbose=False, max_iter=-1):
15791579

sklearn/svm/src/libsvm/svm.cpp

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

18331833
static void solve_svdd_l1(
18341834
const PREFIX(problem) *prob, const svm_parameter *param,
1835-
double *alpha, Solver::SolutionInfo* si)
1835+
double *alpha, Solver::SolutionInfo* si, BlasFunctions *blas_functions)
18361836
{
18371837
int l = prob->l;
18381838
int i, j;
18391839

18401840
double r_square;
18411841

1842-
ONE_CLASS_Q Q = ONE_CLASS_Q(*prob, *param);
1842+
ONE_CLASS_Q Q = ONE_CLASS_Q(*prob, *param, blas_functions);
18431843

18441844
if(param->nu < 1) {
18451845
// case \nu < 1: the dual problem is
@@ -1981,7 +1981,7 @@ static decision_function svm_train_one(
19811981
break;
19821982
case SVDD_L1:
19831983
si.upper_bound = Malloc(double,prob->l);
1984-
solve_svdd_l1(prob,param,alpha,&si);
1984+
solve_svdd_l1(prob,param,alpha,&si,blas_functions);
19851985
break;
19861986
}
19871987

@@ -2929,7 +2929,7 @@ double PREFIX(predict_values)(const PREFIX(model) *model, const PREFIX(node) *x,
29292929

29302930
if(model->param.svm_type == SVDD_L1)
29312931
{
2932-
double K_xx = NAMESPACE::Kernel::k_function(x,x,model->param) / 2;
2932+
double K_xx = NAMESPACE::Kernel::k_function(x,x,model->param,blas_functions) / 2;
29332933
for(int i=0;i<model->l;i++)
29342934
sum -= sv_coef[i] * K_xx;
29352935
}
@@ -3247,7 +3247,8 @@ const char *PREFIX(check_parameter)(const PREFIX(problem) *prob, const svm_param
32473247
if(svm_type == C_SVC ||
32483248
svm_type == EPSILON_SVR ||
32493249
svm_type == NU_SVR ||
3250-
svm_type == ONE_CLASS)
3250+
svm_type == ONE_CLASS ||
3251+
svm_type == SVDD_L1)
32513252
{
32523253
PREFIX(problem) newprob;
32533254
// filter samples with negative and null weights

0 commit comments

Comments
 (0)
0