Skip to content

Commit 6417600

Browse files
agoscinskiPicoCentauri
authored andcommitted
change numerical unstable doctest in CUR
* the X_current_ was in the last iteration numerically zero which resulted in machine dependent pi scores in the last iteration
1 parent 656a5b7 commit 6417600

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/skmatter/sample_selection/_base.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,23 +337,24 @@ class CUR(_CUR):
337337
>>> selector = CUR(n_to_select=2, random_state=0)
338338
>>> X = np.array(
339339
... [
340-
... [0.12, 0.21, 0.02], # 3 samples, 3 features
341-
... [-0.09, 0.32, -0.10],
342-
... [-0.03, -0.53, 0.08],
340+
... [0.12, 0.21, -0.11], # 4 samples, 3 features
341+
... [-0.09, 0.32, 0.51],
342+
... [-0.03, 0.53, 0.14],
343+
... [-0.83, -0.13, 0.82],
343344
... ]
344345
... )
345346
>>> selector.fit(X)
346347
CUR(n_to_select=2)
347-
>>> np.round(selector.pi_, 2) # importance scole
348-
array([0., 1., 0.])
349-
>>> selector.selected_idx_ # importance scole
350-
array([2, 0])
348+
>>> np.round(selector.pi_, 2) # importance score
349+
array([0.01, 0.99, 0. , 0. ])
350+
>>> selector.selected_idx_ # selected idx
351+
array([3, 2])
351352
>>> # selector.transform(X) cannot be used as sklearn API
352353
>>> # restricts the change of sample size using transformers
353354
>>> # So one has to do
354355
>>> X[selector.selected_idx_]
355-
array([[-0.03, -0.53, 0.08],
356-
[ 0.12, 0.21, 0.02]])
356+
array([[-0.83, -0.13, 0.82],
357+
[-0.03, 0.53, 0.14]])
357358
"""
358359

359360
def __init__(

0 commit comments

Comments
 (0)