-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Segmentation Fault and ZeroDivisionError
in Group Lasso
#292
Changes from 3 commits
dd40914
cd77bb6
afaf973
629cee7
028ec44
b988f1a
169be60
a87fbf8
2e89487
de6133c
265d2c9
71f8dc8
a6de333
69372b8
32309a1
c4d6a43
138bd97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,7 @@ cpdef floating dnorm_grp( | |
|
||
else: # scaling only with features in C | ||
for g_idx in range(ws_size): | ||
if weights[g] == INFINITY: | ||
if weights[g_idx] == INFINITY: | ||
continue | ||
|
||
g = C[g_idx] | ||
|
@@ -418,8 +418,11 @@ cpdef celer_grp( | |
&inc) / lc_groups[g] | ||
norm_wg += w[j] ** 2 | ||
norm_wg = sqrt(norm_wg) | ||
bst_scal = max(0., | ||
if norm_wg != 0.: | ||
bst_scal = max(0., | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm perhaps lacking context about the code, namely I ignore the purpose of I just followed commun sense to handle the case of norm w being zero. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bst_scal is for BockSofthThresholding scaling : the formula for the BST of I'm curious, how do you end up with a vanishing |
||
1. - alpha * weights[g] / lc_groups[g] * n_samples / norm_wg) | ||
else: | ||
bst_scal = 0. | ||
|
||
for k in range(grp_ptr[g + 1] - grp_ptr[g]): | ||
j = grp_indices[grp_ptr[g] + k] | ||
|
@@ -448,5 +451,3 @@ cpdef celer_grp( | |
'Fitting data with very small alpha causes precision issues.', | ||
ConvergenceWarning) | ||
return np.asarray(w), np.asarray(theta), np.asarray(gaps[:t + 1]) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure that it's not g (defined L95, so def should be moved above) which should be used here? weights has size n_groups, not ws_size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are right,
We can insert line 95 right after Line 91 and keep the rest as it is