Linear Model

This is the formula for the linear model y = a * x + b. My question here is, how did you get the values for a, x, and b. Did you choose from the values of the features between the range of the min and max? I understood how you got the value of b x as shown below flipper_length_range = np.linspace(data.min(), data.max(), num=300) then how come num=300.

My question is two

  1. How did you get the values of a and b
  2. How is num =300

It was an example to illustrate the impact of the parameter of a and b. These parameters were chosen by hand without any optimization involved. x is indeed the value of our input data. At prediction time, we just generate some flipper length. We request 300 data points, generated equally spaced between the minimum and maximum of the training data.

Okay but if I want to use a real dataset, how do i make use of the formular above to solve the problem?

This is a completely different problem. We are doing an example to understand what is a parametric linear model. When it comes to optimizing it, we are using for instance LinearRegression or Ridge that find the best parameters that minimize an error. This is what we do in the subsequent notebooks.

We don’t go into details regarding the optimization process.

1 Like

Okay. Thanks