1 #backward elimination 2 import statsmodels.regression.linear_model as sm 3 4 # add a column of ones as integer data type 5 data = np.append(arr = np.ones ((3755, 1)).astype (int), values = data, axis = 1) 6 7 # choose a significance level usually 0.05, if p>0.05 8 # for the highest values parameter, remove that value 9 x_opt = data[:,[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]] ols=sm.OLS (endog = salary, exog = x_opt).fit() 1 ols.summary()

icon
Related questions
Question

Please explains in details the meaning of 2 attached file?

(attached file was running with Python Jupyter Notebook)

1 #backward elimination
2 import statsmodels.regression.linear_model as sm
3
4 # add a column of ones as integer data type
5 data = np.append(arr = np.ones((3755, 1)).astype (int), values = data, axis = 1)
6
7 # choose a significance level usually 0.05, if p>0.05
8 # for the highest values parameter, remove that value
9 x_opt = data[:,[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]]
10 ols=sm.OLS (endog = salary, exog = x_opt).fit()
11 ols.summary()
Transcribed Image Text:1 #backward elimination 2 import statsmodels.regression.linear_model as sm 3 4 # add a column of ones as integer data type 5 data = np.append(arr = np.ones((3755, 1)).astype (int), values = data, axis = 1) 6 7 # choose a significance level usually 0.05, if p>0.05 8 # for the highest values parameter, remove that value 9 x_opt = data[:,[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]] 10 ols=sm.OLS (endog = salary, exog = x_opt).fit() 11 ols.summary()
1 from sklearn.preprocessing import Label Encoder
2 le=LabelEncoder ()
3 col1 = ['employment_type', 'job_title', 'salary_currency', 'employee_residence', 'company_location']
4 data[col1] = data[col1].apply(Label Encoder ().fit_transform)
5
6 print (data)
Transcribed Image Text:1 from sklearn.preprocessing import Label Encoder 2 le=LabelEncoder () 3 col1 = ['employment_type', 'job_title', 'salary_currency', 'employee_residence', 'company_location'] 4 data[col1] = data[col1].apply(Label Encoder ().fit_transform) 5 6 print (data)
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer