]> granicus.if.org Git - liblinear/commitdiff
ndarray.resize pads with zeros, np.resize doesn't
authorSinacam <stinkingmadgod@gmail.com>
Sat, 6 Aug 2022 02:13:24 +0000 (10:13 +0800)
committerSinacam <stinkingmadgod@gmail.com>
Sun, 7 Aug 2022 09:23:25 +0000 (17:23 +0800)
python/liblinear/commonutil.py

index 6ec304b52f4b1760ebbc4d91135fcb065bf15b7b..91e015119e1f872a567a9996b1005c75e6d7ec94 100644 (file)
@@ -160,8 +160,8 @@ def csr_scale(x, scale_param):
 
     if not n == len(coef):
         print("WARNING: The dimension of scaling parameters and feature number do not match.", file=sys.stderr)
-        coef = np.resize(coef, n)
-        offset = np.resize(offset, n)
+        coef = coef.resize(n)
+        offset = offset.resize(n)
 
     # scaled_x = x * diag(coef) + ones(l, 1) * offset'
     offset = sparse.csr_matrix(offset.reshape(1, n))