Exercises
Next is a series of exercises. Answers to all the exercises are given in the Answers_to_Exercises_Chap4.ipynb
Jupyter notebook in the GitHub repository:
- Look at the documentation for the
scikit-learn
class namedsklearn.linear_model.LinearRegression
, which can fit a linear model using OLS regression. See if you can use it to fit a linear model to the power-plant output data that we analyzed in the code example in the Linear models section of this chapter. Do you get the same parameter estimates as when we used thestatsmodels
package? - The data plotted in Figure 4.3 is stored in the
Data/outliers_example.csv
file of the GitHub repository. Using the pseudo-Huber loss function in Eq. 12 and a learning rate of , see if you can use the simple gradient descent algorithm to construct robust estimates for both the intercept and the slope for a linear model of the data. - The data in the
Data/nls_example.csv
file of the GitHub repository contains data that has been generated...