Skip to content

Commit 0c07a99

Browse files
author
vm-aifluence-jro
committed
testing n_rows not divising X size
1 parent f6e55a1 commit 0c07a99

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

qolmat/imputations/rpca/rpca.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ def _prepare_data(self, X: NDArray) -> NDArray:
5858
raise ValueError("`n_rows` should not be specified when imputing 2D data.")
5959

6060
def get_shape_original(self, X: NDArray, shape: Tuple[int]) -> NDArray:
61-
if len(shape) == 1 or shape[0] == 1:
62-
n_values = sum(shape)
63-
return X.reshape(1, -1)[:, :n_values]
64-
else:
65-
return X
61+
# if len(shape) == 1 or shape[0] == 1:
62+
# n_values = sum(shape)
63+
# return X.reshape(1, -1)[:, :n_values]
64+
# else:
65+
# return X
66+
X = X.flatten()[: np.prod(shape)]
67+
return X.reshape(shape)

tests/imputations/rpca/test_rpca.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def test_rpca__prepare_data_1D_succeed(X: NDArray):
5858
[
5959
(2, X_flat, X_exp_nrows_2_pcp_decompose_rpca_signal),
6060
(3, X_flat, X_exp_nrows_3_pcp_decompose_rpca_signal),
61+
(4, X_flat, X_exp_nrows_3_pcp_decompose_rpca_signal),
6162
(None, X_incomplete, X_exp_nrows_1_pcp_decompose_rpca_signal),
6263
],
6364
)

0 commit comments

Comments
 (0)