In the current version of the Python textbook, the code that computes RMSPE (using the Sacramento test data) is currently written as:
RMSPE = mean_squared_error(
sacramento_test["price"],
sacramento_test["predicted"]
) ** (1/2)
In recent versions of scikit‑learn (v1.4+), a dedicated function
root_mean_squared_error is available. See below. (Also the "squared=False" option is being deprecated). Using the new function avoids manual square‑rooting and future warnings:
from sklearn.metrics import root_mean_squared_error
RMSPE = root_mean_squared_error(
sacramento_test["price"],
sacramento_test["predicted"]
)
From Hossein @ KU: