Question: 3) Create a user defined function for the given Python program. Importing data into Python from filename.csv Use the same parameters and variables as defined

 3) Create a user defined function for the given Python program.

3) Create a user defined function for the given Python program. Importing data into Python from filename.csv Use the same parameters and variables as defined in the following Python programs. Run your programs 3- Gradient descent method error_sq_list - Loss mean square error list bo, b1 -0,0 # Initialization of the parameters alpha 10e-1W Learning rate num iterations - 100 # Number of iterations/replications len_samples len(sales) Number of samples - m samples range(len samples) # List of samples index count while count prediction of sales - bohat+bihat tv_add predict_minus_actual - predict - sales[0 dbo += predict_minus_actual db1 + predict_minus_actual tv_ad[] error_sq += predict_minus_actual** 2# Compute square error and accumulate bo = b0-alpha - (dbo / len_samples) b1 =b1 - alpha . (db1/len_samples) error r_sq_list.append((error sq/len_samples)) print(" Gradient Descent Method: sales = ", round(b0,3), "", round(b1,3)," tv_ad") count +1 3) Create a user defined function for the given Python program. Importing data into Python from filename.csv Use the same parameters and variables as defined in the following Python programs. Run your programs 3- Gradient descent method error_sq_list - Loss mean square error list bo, b1 -0,0 # Initialization of the parameters alpha 10e-1W Learning rate num iterations - 100 # Number of iterations/replications len_samples len(sales) Number of samples - m samples range(len samples) # List of samples index count while count prediction of sales - bohat+bihat tv_add predict_minus_actual - predict - sales[0 dbo += predict_minus_actual db1 + predict_minus_actual tv_ad[] error_sq += predict_minus_actual** 2# Compute square error and accumulate bo = b0-alpha - (dbo / len_samples) b1 =b1 - alpha . (db1/len_samples) error r_sq_list.append((error sq/len_samples)) print(" Gradient Descent Method: sales = ", round(b0,3), "", round(b1,3)," tv_ad") count +1

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!