{"id":16821,"date":"2022-03-29T06:32:35","date_gmt":"2022-03-28T22:32:35","guid":{"rendered":"https:\/\/www.tejwin.com\/?post_type=insight&#038;p=16821"},"modified":"2026-03-03T13:18:17","modified_gmt":"2026-03-03T05:18:17","slug":"lasso-regression-model","status":"publish","type":"insight","link":"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/","title":{"rendered":"Lasso Regression Model"},"content":{"rendered":"\n<p id=\"1325\">Effective Explanatory Variables for Economic Growth<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1_1gtJeCka-IbI3z1HfoX8scg.jpg\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Photo by&nbsp;<a href=\"https:\/\/unsplash.com\/@lukechesser\" rel=\"noreferrer noopener\" target=\"_blank\">Luke Chesser<\/a>&nbsp;on&nbsp;<a href=\"https:\/\/unsplash.com\/\" rel=\"noreferrer noopener\" target=\"_blank\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69f2e47b18e6a\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69f2e47b18e6a\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/#Highlights\" >Highlights<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/#Preface\" >Preface<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/#Editing_Environment_and_Modules_Required\" >Editing Environment and Modules Required<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/#Database\" >Database<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/#Data_Selection\" >Data Selection<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/#Data_Pre-processing\" >Data Pre-processing<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/#Model_Construction\" >Model Construction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/#Model_Comparison%EF%BC%86Finding_Effective_Explanatory_Variables\" >Model Comparison\uff06Finding Effective Explanatory Variables<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/#Source_Code\" >Source Code<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/#Extended_Reading\" >Extended Reading<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.tejwin.com\/en\/insight\/lasso-regression-model\/#Related_Link\" >Related Link<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"3210\"><span class=\"ez-toc-section\" id=\"Highlights\"><\/span><strong>Highlights<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Difficulty\uff1a\u2605\u2605\u2606\u2606\u2606<\/li>\n\n\n\n<li>Apply Lasso Model to find effective variables on explaining economic growth<\/li>\n\n\n\n<li>Reminder\uff1aWe would firstly select data and conduct pre-processing. Subsequently, implement the fitting. In the context, we would not discuss mathematics theorem but simply describe the function and meaning of the model. However, it is a requirement for you that have basic knowledge of Statistics. As for Lasso Model, we would introduce in Preface area.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"8214\"><span class=\"ez-toc-section\" id=\"Preface\"><\/span><strong>Preface<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"6d91\">Least Absolute Shrinkage and Selection Operator, short as Lasso, is mainly used for variable selection and regularization in Regression. The function of \u201cPenalty\u201d setting would in Lasso lets us adjust the complexity. Therefore, with Lasso, we are able to alleviate \u201cOverfitting\u201d.<\/p>\n\n\n\n<p id=\"15ed\">Penalty in the model is used to determine the weights between \u201cError\u201d and \u201cAmount of Variable\u201d. Namely, we would not only consider the goal to minimize error, but try to reduce amount of variable so as to achieve an \u201cadequate\u201d complexity. Hence, if we set a small parameter on penalty, the model will prefer \u201creducing error\u201d. On the other hand, a large parameter represent that model emphasize \u201creducing variable amount\u201d.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p id=\"a652\"><em>Note: Penalty parameter must greater than 0 to match the condition of \u201cconsidering less variables\u201d. To boot, the parameter setting name is \u201cAlpha\u201d in Python package.<\/em><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"f011\"><span class=\"ez-toc-section\" id=\"Editing_Environment_and_Modules_Required\"><\/span><strong>Editing Environment and Modules Required<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"4959\">MacOS &amp; Jupyter Notebook<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Basic<br>import numpy as np<br>import pandas as pd# Graph<br>import matplotlib.pyplot as plt<br>%matplotlib inline<br>import seaborn as sns<br>sns.set()# TEJ API<br>import tejapi<br>tejapi.ApiConfig.api_key = 'Your Key'<br>tejapi.ApiConfig.ignoretz = True<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"6259\"><span class=\"ez-toc-section\" id=\"Database\"><\/span><strong>Database<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"f215\"><a href=\"https:\/\/api.tej.com.tw\/columndoc.html?subId=6\" rel=\"noreferrer noopener\" target=\"_blank\">Macroeconomics Data Explain Table<\/a>: Illustrate information about recorded Macroeconomics data. Code is \u201cGLOBAL\/ABMAR\u201d.<\/p>\n\n\n\n<p id=\"bc13\"><a href=\"https:\/\/api.tej.com.tw\/columndoc.html?subId=5\" rel=\"noreferrer noopener\" target=\"_blank\">Macroeconomics Data Table<\/a>: Macroeconomics data from official government. Source: IMF, OECD and relatively professional issues. Code is \u201cGLOBAL\/ANMAR\u201d.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"0dd1\"><span class=\"ez-toc-section\" id=\"Data_Selection\"><\/span><strong>Data Selection<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"cf1d\"><strong>Step 1. Import Basic Information of Data<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">factor = tejapi.get('GLOBAL\/ABMAR',<br>                opts={'columns': ['coid','mdate', 'cname', 'freq']},<br>                chinese_column_name=True,<br>                paginate=True)<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1j8BrlLu14bQaxNh-PkiwRQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"206f\"><strong>Step 2. Select Specific Data<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Selection<br>list1 = list(factor['\u7e3d\u7d93\u4ee3\u78bc'][i] for i in range(0,6214) if '\u53f0\u7063' in factor.iloc[i,2] and factor['\u983b\u7387\u4ee3\u78bc'][i] == 'Q')# Table<br>factor = factor[factor['\u7e3d\u7d93\u4ee3\u78bc'].isin(list1)].reset_index().drop(columns =['None', '\u76ee\u524d\u72c0\u614b', '\u983b\u7387\u4ee3\u78bc'])<\/pre>\n\n\n\n<p id=\"98a4\">Since the amount of Macro indexes is extremely large and diverse. It is impossible to fit all data in model. As a result, we would only consider \u201d<strong>Quarterly Data of Taiwan<\/strong>\u201d.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1ICpT8C3oOx_glVDRhWJH_w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"8931\"><strong>Step 3. Import Numeric Data<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data = tejapi.get('GLOBAL\/ANMAR',<br>                  mdate={'gte': '2008-01-01', 'lte':'2021-12-31'},<br>                  opts={'columns': ['coid','mdate', 'val', 'pfr']},<br>                  coid = list1, # \u7b26\u5408\u689d\u4ef6\u7684\u6307\u6a19<br>                  chinese_column_name=True,<br>                  paginate=True)<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/10Lz-7vqXJKCHeg66lDX7tw.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"baf8\"><span class=\"ez-toc-section\" id=\"Data_Pre-processing\"><\/span><strong>Data Pre-processing<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"1790\"><strong>Step 1. Remove Forecasting Data<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data = data[data['\u9810\u4f30(F)'] != 'F']<\/pre>\n\n\n\n<p id=\"67df\"><strong>Step 2. Rearrange Table<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data = data.set_index('\u5e74\u6708')df = {}for i in list1:<br>    p = data[data['\u4ee3\u78bc'] == i]<br>    p = p['\u6578\u503c']<br>    df.setdefault(i, p)df = pd.concat(df, axis = 1)<\/pre>\n\n\n\n<p id=\"1201\">We firstly set \u201cYear-Month\u201d as table index. Then, read each type of data. Lastly, arrange new table that each columns record different Macro indexes.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/16Mojo_gfBif7vlIduaR_Dw.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"41a8\"><strong>Step 3. Select Economic Growth Rate, Y<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Display all economic growth rate indexes<br>growth_reference = list(factor['\u7e3d\u7d93\u4ee3\u78bc'][i] for i in range(0,427) if '\u7d93\u6fdf\u6210\u9577\u7387' in factor.iloc[i,1])factor[factor['\u7e3d\u7d93\u4ee3\u78bc'].isin(growth_reference)]# Select 'NE0904-\u5b63\u7bc0\u8abf\u6574\u5f8c\u5e74\u5316\u7d93\u6fdf\u6210\u9577\u7387' as Y<br>growth = df['NE0904']<\/pre>\n\n\n\n<p id=\"2624\">Since Taiwan is export-oriented, its economic performance is easily affected by global consumption cycle. We, therefore, choose \u201c<strong>NE0904-Seasonal Adjusted Annualized Rate(saar)<\/strong>\u201d as the reference of economic growth.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Remove economic growth data in df <br>df = df.drop(columns = growth_reference)# Remove nan<br>df = df.dropna(axis = 1, how = 'any')<\/pre>\n\n\n\n<p id=\"236a\"><strong>Step 4. Stationary Test<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">from statsmodels.tsa.stattools import adfuller<br>    <br>for i in df.columns.values:<br>    p_value = adfuller(df[i])[1]<br>    if p_value &gt; 0.05:<br>        df = df.drop(columns = i)<br>        <br>df = df.dropna(axis = 1, how = 'any')print('\u89e3\u91cb\u8b8a\u6578\u91cf\uff1a', len(df.columns))<br>print('\u7d93\u6fdf\u6210\u9577\u7387\u5b9a\u614b\u6aa2\u5b9a\uff30\u503c\uff1a', '{:.5f}'.format(adfuller(growth)[1]))<\/pre>\n\n\n\n<p id=\"5549\">Implement stationary test on each variable with for loop. Remove data which is non-stationary. We would not conduct differencing. On top of that, calculate the amount of explanatory variable, which is 148. Lastly, conduct stationary test on economic growth rate. P-value is 0.0000.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"9b71\"><span class=\"ez-toc-section\" id=\"Model_Construction\"><\/span><strong>Model Construction<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"98fe\"><strong>Step 1. Import Packages &amp; split Data<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">from sklearn.linear_model import Lasso<br>from sklearn.pipeline import Pipeline<br>from sklearn.preprocessing import PolynomialFeaturesdf_train = df.head(45)<br>df_valid = df.tail(10)growth_train = growth.head(45)<br>growth_valid = growth.tail(10)<\/pre>\n\n\n\n<p id=\"eeee\"><strong>Step 2. Model Fitting<\/strong><\/p>\n\n\n\n<p id=\"80b0\">We would only show the code of \u201cBig Alpha\u201d model here. As for the code of medium and small alpha model, please check \u201cSource Code\u201d.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># big alpha modelLasso_l = Pipeline(steps = [('poly', PolynomialFeatures(degree = 1)), ('Lasso', Lasso(<strong>alpha = 1000<\/strong>))])<br>large = Lasso_l.fit(df_train, growth_train)<br>growth_pred_l = large.predict(df_valid)<br>large_alpha = list(growth_pred_l)print('\u5927Alpha\u7684MSE:', metrics.mean_squared_error(growth_valid, large_alpha))<\/pre>\n\n\n\n<p id=\"af8e\">Due to the amount of explanatory variable, which is 148, we would consider the effectiveness of each variable itself. We make degree as 1. Besides, in order to make model more stricter, we set Alpha with three class, 10, 100 and 1000.<\/p>\n\n\n\n<p id=\"cbb2\">MSE of each model are as follow:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p id=\"b169\"><em>Big Alpha MSE: 207.82<\/em><\/p>\n\n\n\n<p id=\"8feb\"><em>Medium Alpha MSE: 526.29<\/em><\/p>\n\n\n\n<p id=\"7037\"><em>Small Alpha MSE: 1399.59<\/em><\/p>\n<\/blockquote>\n\n\n\n<p id=\"3484\">According to above comparison, we would tell that the big alpha model outperforms others. Subsequently, we would visualize valid dataset and select the final model.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"f656\"><span class=\"ez-toc-section\" id=\"Model_Comparison%EF%BC%86Finding_Effective_Explanatory_Variables\"><\/span><strong>Model Comparison\uff06Finding Effective Explanatory Variables<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"d6ef\"><strong>Step 1. Rearrange Table<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pred_data = {'\u5c0fAlpha\u9810\u6e2c\u503c': small_alpha, '\u4e2dAlpha\u9810\u6e2c\u503c': medium_alpha, '\u5927Alpha\u9810\u6e2c\u503c':large_alpha}<br>result = pd.DataFrame(pred_data, index = growth_valid.index)<br>final = pd.concat([growth_valid, result], axis = 1)<br>final = final.rename(columns={'NE0904':'\u5be6\u969b\u7d93\u6fdf\u6210\u9577\u7387'})<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/1JUo5A81_JAwqkzU2aUvOpA.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"987c\"><strong>Step 2. Visualization<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Make Python apply Chinese<br>plt.rcParams['font.sans-serif'] = ['Arial Unicode MS']plt.figure(figsize=(15,8))plt.plot(final['\u5be6\u969b\u7d93\u6fdf\u6210\u9577\u7387'])<br>plt.plot(final['\u5c0fAlpha\u9810\u6e2c\u503c'])<br>plt.plot(final['\u4e2dAlpha\u9810\u6e2c\u503c'])<br>plt.plot(final['\u5927Alpha\u9810\u6e2c\u503c'])plt.legend(('\u5be6\u969b\u6210\u9577\u7387', '\u5c0fAlpha\u9810\u6e2c', '\u4e2dAlpha\u9810\u6e2c', '\u5927Alpha\u9810\u6e2c'), fontsize=16)<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/13-x_J4WApeoWzwAF4N-pdQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"37ff\">Based on above graph, we could clearly compare the three model, big(red) medium(green) and small(orange) alpha with actual number(blue). We conclude that result of big alpha model is closer to actual one than other two model. Hence, we would apply big alpha model to find effective variable for explaining economic growth rate.<\/p>\n\n\n\n<p id=\"cd44\"><strong>Step 2. Effective Variables<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Re-fitting the model<br>lasso = Lasso(alpha = 1000)<br>mdl = lasso.fit(df_train,growth_train)# Display variables that coefficient is larger than 0<br>lasso_coefs = pd.Series(dict(zip(list(df_valid), mdl.coef_)))<br>coefs = pd.DataFrame(dict(Coefficient=lasso_coefs))<br>coid = coefs[coefs['Coefficient'] &gt; 0].index# Match the Code of selected variables to find Chinese name<br>factor[factor['\u7e3d\u7d93\u4ee3\u78bc'].isin(coid)]<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/19QlJHLXKOs90tq7GVY7jaQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"63f7\">According to above chart, we conclude that the majority of variables consists of international trade-related and finance-related data, which matches the condition of Taiwan, an export-oriented country. To boot, one of above variables is GDP of Education Industry. It proves that the improvement of education among population would benefit economic growth.Therefore, keep cultivating next generation is what we should notice.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"c46b\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"689d\">With above context, we firstly show data selection and pre-processing. Subsequently, implement model fitting and comparison. Lastly, find the effective explanatory variables for economic growth. It is clear that we spare advanced data transformation or differencing so as to keep this article from redundancy. Of course you do not have to follow our steps. As for the setting of parameters in model, we encourage you to try your own set. Believe you would gain much knowledge by practice. Last but not least, if you are interested in model construction, but concern the data source. Welcome to purchase the plans offered in&nbsp;<a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/index\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ E Shop<\/a>&nbsp;and use the well-complete database to implement your own model.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"ecd1\"><span class=\"ez-toc-section\" id=\"Source_Code\"><\/span><strong>Source Code<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/gist.github.com\/tej87681088\/9fd85d0fc2cde5d309b80cb9fbf7d3c3#file-tejapi_medium-12-ipynb\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Click here to go Github<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"fefd\"><span class=\"ez-toc-section\" id=\"Extended_Reading\"><\/span><strong>Extended Reading<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.tejwin.com\/en\/insight\/defensive-stocks-recover-after-going-ex-dividend\/\" class=\"ek-link\">defensive stocks -recover after going ex-dividend<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.tejwin.com\/en\/insight\/momentum-select\/\" class=\"ek-link\">Momentum select<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4f33\"><span class=\"ez-toc-section\" id=\"Related_Link\"><\/span><strong>Related Link<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/api.tej.com.tw\/index.html\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ API<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/Edata_intro\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ E-Shop<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Effective Explanatory Variables for Economic Growth Highlights Preface Least Absolute Shrinkage and Selection Operator, short as Lasso, is mainly used for variable selection and regularization in Regression. The function of \u201cPenalty\u201d setting would in Lasso lets us adjust the complexity. Therefore, with Lasso, we are able to alleviate \u201cOverfitting\u201d. Penalty in the model is used [&hellip;]<\/p>\n","protected":false},"featured_media":16823,"template":"","tags":[3176,3007],"insight-category":[690,3509,50],"class_list":["post-16821","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-python-2","tag-tejapi-data-analysis","insight-category-data-analysis","insight-category-fintech-en","insight-category-fintech"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/16821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight"}],"about":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/types\/insight"}],"version-history":[{"count":1,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/16821\/revisions"}],"predecessor-version":[{"id":44096,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/16821\/revisions\/44096"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media\/16823"}],"wp:attachment":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media?parent=16821"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/tags?post=16821"},{"taxonomy":"insight-category","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight-category?post=16821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}