Skip to content

Commit 80706e5

Browse files
committed
Fix np.asmatrix replacement: correct reshape to match original behavior
The original np.asmatrix on a 1D array creates a row vector (1, m), which when transposed becomes (m, 1). The previous fix created (m, 1) directly, which when transposed gave (1, m), causing a shape mismatch in np.append. Changed reshape(-1, 1) to reshape(1, -1) to match the original np.asmatrix behavior.
1 parent de2b164 commit 80706e5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

navicat_marc/clustering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def _get_mean(sums, step):
519519

520520
centroids = np.zeros((k, n))
521521

522-
composite = np.array(np.sum(ds, axis=1)).reshape(-1, 1)
522+
composite = np.array(np.sum(ds, axis=1)).reshape(1, -1)
523523
ds = np.append(composite.T, ds, axis=1)
524524
ds.sort(axis=0)
525525

0 commit comments

Comments
 (0)