Question: can someone help me check what i do wrong in this code!! def answer_four(): from sklearn.preprocessing import PolynomialFeatures from sklearn.linear_model import Lasso, LinearRegression poly =

 can someone help me check what i do wrong in this

can someone help me check what i do wrong in this code!!

def answer_four():

from sklearn.preprocessing import PolynomialFeatures

from sklearn.linear_model import Lasso, LinearRegression

poly = PolynomialFeatures(12)

X_train_poly = poly.fit_transform(X_train[None].T)

X_test_poly = poly.fit_transform(X_test[None].T)

linreg = LinearRegression().fit(X_train_poly,y_train)

linlasso = Lasso(alpha=0.01,max_iter=10000).fit(X_train_poly,y_train)

return (linreg.score(X_test_poly,y_test),linlasso.score(X_test_poly,y_test))

answer_four() because I always getting this answer!! code!! def answer_four(): from sklearn.preprocessing import PolynomialFeatures from sklearn.linear_model import Lasso, LinearRegression

Training models on high degree polynomial features can result in overfitting. Train two models: a non-regularized LinearRegression model and a Lasso Regression model (with parameters tol=0.1 ) on polynomial features of degree 12 . Return the R2 score for LinearRegression and Lasso model's test sets. This function should return a tuple (LinearRegression_R2_test_score, Lasso_R2_test_score) You have failed this test due to an error. The traceback has been removed because it may conta in hidden tests. This is the exception that was thrown: AssertionError: Q4: Lasso_R2_test_score has inc orrect value

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!