I know that we can do cross validation in simple linear regression as
lnrreg = LinearRegression()
scores = cross_val_score(lnrreg, X, Y, cv=4, scoring='neg_mean_squared_error')
But how do we do cross_val_score()
on linear regression of higher order?
Is this the right solution?
lnrreg = LinearRegression()
Xd = PolynomialFeatures(3).fit_transform(X)
scores = cross_val_score(lnrreg, Xd, Y, cv=4, scoring='neg_mean_squared_error')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.