- Exercises for May 8:
- Extra exercises 9 (Vinnie's solution, pp. 30-31 and code)
- Exam 2021: Problem 3 (Solution)
- Exam 2019: Problem 3 (Solution)
- Exam 2022: Problem 2, 3 (Solutions)
- Exercises for May 4 (will be discussed on Tuesday May 9):
- Exam 2021: Exercise 1, 2 (Solutions)
- Exercises for April 24:
- From the textbook: Exercise 9.6 (in b only fit a tree)
- From the ISLR book: Exercise 8.4, 8.8a-c (Solutions. In 8.8b, use "
text(tree_model, pretty = 0, cex = 0.7)"
for a nicer plot) - Exam 2022: Problem 3 (Solution)
- The ROC curve we have not discussed in the lectures but are described on page 314-317 in the textbook. Read this as part of the exercise. The main message though is that the area under the curve should be as large as possible. Note also that the x-axis in the exercise is flipped compared with Figure 9.6 in the textbook.
- Exercises for April 17:
- Exercises for April 13 (Note the day!)
- Extra exercises 12 and 13 (Solution)
- We skip exercise 12 since this exercise is partly included in the compulsory exercise.
- Extra exercises 12 and 13 (Solution)
- Exercises for March 27:
- ???From ISLR book: Exercise 7.9.1, 7.9.9 (Solution, if you want default R-plots in 7.9.9 then see this solution)
- From textbook: Exercise 5.4 (Solution, pp. 94-95)
- Exam 2018: Problem 2 (Solution, pp. 2-4, ps. it is in Norwegian)
- ??Challenge:
- From textbook: Exercise 5.7 (Solution)
- Extra exercise 7 (Vinnie's solution, pp. 22-27)
- Exercises for March 13
- Exercises 4.2 and 5.1 in the textbook (Solution for 4.2 and solution for 5.1, but this provides some additional explanations)
- Exercises 4.9 and 4.14(a-h) from the new version of the ISLR book (Solution for 4.9 and for 4.14 just use the code from the lab section of the chapter.)
- Exam STK2100 2018: Problem 2 (Solution, pp. 2-4, ps. it is in Norwegian)
- Extra exercise 6 (Solution, p. 13)
- Exercises for March 6:
- Modify the hitters_pca.r script so that the numbers of principal components are selected through cross-validation instead of through separate train- and test-sets. Comment on the results. (Code)
- Exercise 4.1 from the textbook (Solution, pp. 75-76)
- Exercise 4.10 from the ISLR book (the last points we may not have covered yet and can be postponed to next week) (Solution with default R and solution using Tidyverse)
- Challenge: Extra exercises 2 and 3 (Vinnie's solutions)
- Exercises for February 27:
- Exercises 3.5 and 3.29 from the textbook (Solution and solution, pp. 56-58)
- From the ISLR book: Exercises 6.1, 6.4, 6.10 (Solutions, if you want default R-plots in 6.10 then see this solution)
- Challenge: Exercise 2.9 from the textbook (Solution, pp. 10-12)
- A somewhat simpler version of this exercise is extra exercise 18 (Some notes)
- Exercises for February 20:
- From the ISLR book: Exercises 3.5, 3.8, 3.9, 3.14 (Solutions)
- From the main textbook: 3.2 (Solution, pp. 44-45, Lars' code)
- Extra exercise 5 (Vinnie's solution)
- Exercises for February 13:
- From the ISLR book: Exercises 3.3. 3.4, 3.6, and 3.7 (Solutions)
- Extra exercises 4 and 5 (Vinnie's solutions, extra4.r, extra4_extended.r, advertising.r)
- Exercises for February 6:
- Extra exercises 2 and 3 (2 is mainly what we went through at the lecture, but try yourself!) (Vinnie's solutions)
- Extra exercise 1 (This exercise is mainly a preparation for the topic that we will discuss at the lecture on Tuesday, but it will be very helpful to try to work on this in front). (Geir's solution and Vinnie's solution)
- From the ISLR book (James et al): Exercise 3.8, 3.5 (3.5 is a simplified version of extra exercise 1, perhaps easier to try this before that one) (See e.g. Vinnie's solutions, this solution, or this solution).
- Exercises for January 30:
- Exercise 2.7 from the textbook. (Solution, pp. 8-9, many small typos, unfortunately. In a), note that \hat{f}(x_0) = x_0^T(X^TX)^{-1}X^TY, and not \hat{f}(x_0) = x_0^TX(X^TX)^{-1}X^TY, and missing y_i in KNN. Should be E_{Y|X}[\hat{f}(x_0)] and not E_{Y|X}[f(x_0)] in b). Same when doing E_{Y, X} in c).)
- Exercises 1, 2, and 8 from chapter 2 of the ISLR book (James et al), see webpage for the book for downloading data. (Solution)
- Regarding exercise 8: The easiest way of getting hold of the data is to install the ISLR library (through the command install.packages("ISLR")), make the library available (through the library("ISLR")), and then make the data available through data(College)
Exercises
Here, weekly exercises will be given. These will normally be published after the lectures on thursdays.
Note that the link to book website given in the book do not work any more, new link is https://hastie.su.domains/ElemStatLearn/
A link to the extra exercises is here.
Some solution proposals are posted below and here (and from last year).
Published Jan. 24, 2023 10:03 AM
- Last modified Jan. 29, 2024 10:54 AM