From 280dfc1a22adb08aa71984ee4b22e4df220a8e68 Mon Sep 17 00:00:00 2001 From: Tianyi Zheng Date: Sun, 1 Oct 2023 00:07:25 -0400 Subject: [PATCH] Fix DeprecationWarning in local_weighted_learning.py (Attempt 2) (#9170) * Fix DeprecationWarning in local_weighted_learning.py Fix DeprecationWarning that occurs during build due to converting an np.ndarray to a scalar implicitly * DeprecationWarning fix attempt 2 --- .../local_weighted_learning/local_weighted_learning.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machine_learning/local_weighted_learning/local_weighted_learning.py b/machine_learning/local_weighted_learning/local_weighted_learning.py index ada6f7cd2..f3056da40 100644 --- a/machine_learning/local_weighted_learning/local_weighted_learning.py +++ b/machine_learning/local_weighted_learning/local_weighted_learning.py @@ -122,7 +122,7 @@ def local_weight_regression( """ y_pred = np.zeros(len(x_train)) # Initialize array of predictions for i, item in enumerate(x_train): - y_pred[i] = np.dot(item, local_weight(item, x_train, y_train, tau)) + y_pred[i] = np.dot(item, local_weight(item, x_train, y_train, tau)).item() return y_pred