Tejapi資料科學, Lasso Regression, Economic Growth, Macroeconomics, Alpha.
df.tail(10) growth_train = growth.head(45) growth_valid = growth.tail(10) Step 2. 模型擬合 內文僅呈現大懲罰項(Alpha)的模型程式碼，中、小Alpha的內容與其皆相同，而考量到篇幅，此處不呈現該過程。(詳見完整程式碼) # 大alpha模型 Lasso_l = Pipeline(steps = [('poly', PolynomialFeatures(degree = 1)), ('Lasso', Lasso(alpha = 1000))]) large = Lasso_l.fit(df_train,