I have a mulitvariate regression model that for which I'd like to see the residuals. I attempted to output the model's residuals via
model.residues_
But this has been deprecated. Any workarounds?
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up.
Sign up to join this communityThis should be in StackOverflow (probably), but here's a quick workaround:
lm = LinearRegression().fit(X, y)
np.linalg.norm(y - lm.predict(X)) ** 2 #RSS, which is what lm.residues_ returns
y - model.predict(X)
? $\endgroup$model.residues_
returns RSS, not residuals. If you wanted the former, you coudl usenp.linalg.norm(y - model.predict(X)) ** 2
. $\endgroup$._residues
so no need to recompute it again. $\endgroup$