From a7d8787e585d410316e3fca10b90f247e541aadd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Trevisan?= Date: Tue, 15 Feb 2022 21:54:25 -0300 Subject: [PATCH] Retrain the LinearRegressor to add X2 On the "Solution for under-fitting" part we need to retrain the LinearRegressor model to use both 'x' and 'x2' as inputs, or else it will show an error. I added the retrain line on the corresponding cell. --- .../quadratic_xgboost_localmode.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/xgboost/LinearAndQuadraticFunctionRegression/quadratic_xgboost_localmode.ipynb b/xgboost/LinearAndQuadraticFunctionRegression/quadratic_xgboost_localmode.ipynb index 7b81fe5..ffacc3e 100644 --- a/xgboost/LinearAndQuadraticFunctionRegression/quadratic_xgboost_localmode.ipynb +++ b/xgboost/LinearAndQuadraticFunctionRegression/quadratic_xgboost_localmode.ipynb @@ -1352,6 +1352,7 @@ "y = quad_func(X)\n", "df_tmp = pd.DataFrame({'x':X,'y':y,'x2':X**2})\n", "df_tmp['xgboost']=regressor.predict(df_tmp[['x']])\n", + "lin_regressor.fit(X = df_tmp[['x','x2']], y = y)\n", "df_tmp['linear']=lin_regressor.predict(df_tmp[['x','x2']])" ] },