Skip to content

Commit d2f315d

Browse files
authored
Merge pull request #388 from ntumlgroup/change_EURLex-default_to_cddual
change the defaut optimizer to l2 cddual in EUR-lex config
2 parents 6e955f7 + 35fe26f commit d2f315d

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

example_config/EUR-Lex/tree_l2svm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ data_name: EUR-Lex
66
# train
77
seed: 1337
88
linear: true
9-
liblinear_options: "-s 2 -B 1 -e 0.0001 -q"
9+
liblinear_options: "-s 1 -B 1 -e 0.0001 -q"
1010
linear_technique: tree
1111

1212
# eval

example_config/rcv1/l2svm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ data_name: rcv1
66
# train
77
seed: 1337
88
linear: true
9-
liblinear_options: "-s 2 -B 1 -e 0.0001 -q"
9+
liblinear_options: "-s 1 -B 1 -e 0.0001 -q"
1010
linear_technique: 1vsrest
1111

1212
# eval

example_config/rcv1/l2svm_svm_format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ data_name: rcv1
66
# train
77
seed: 1337
88
linear: true
9-
liblinear_options: "-s 2 -B 1 -e 0.0001 -q"
9+
liblinear_options: "-s 1 -B 1 -e 0.0001 -q"
1010
linear_technique: 1vsrest
1111

1212
# eval

libmultilabel/linear/linear.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def _prepare_options(x: sparse.csr_matrix, options: str) -> tuple[sparse.csr_mat
139139
raise ValueError("Invalid LIBLINEAR solver type. Only classification solvers are allowed.")
140140
else:
141141
# workaround for liblinear warning about unspecified solver
142-
options_split.extend(["-s", "2"])
142+
options_split.extend(["-s", "1"])
143143

144144
bias = -1.0
145145
if "-B" in options_split:

libmultilabel/linear/tree.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ def collect_stat(node: Node):
225225
root.dfs(collect_stat)
226226

227227
# 16 is because when storing sparse matrices, indices (int64) require 8 bytes and floats require 8 bytes
228-
return total_num_weights * 16
228+
# Our study showed that among the used features of every binary classification problem, on average no more than 2/3 of weights obtained by the dual coordinate descent method are non-zeros.
229+
return total_num_weights * 16 * 2/3
229230

230231

231232
def _train_node(y: sparse.csr_matrix, x: sparse.csr_matrix, options: str, node: Node):

0 commit comments

Comments
 (0)