Exercises and Projects
2.5. Exercises and Projects#
(Handwritten example)
Consider the 1-dimensional data set shown below.
\(x\) |
1.5 |
2.5 |
3.5 |
4.5 |
5.0 |
5.5 |
5.75 |
6.5 |
7.5 |
10.5 |
---|---|---|---|---|---|---|---|---|---|---|
\(y\) |
\(+\) |
\(+\) |
\(-\) |
\(-\) |
\(-\) |
\(+\) |
\(+\) |
\(-\) |
\(+\) |
\(+\) |
Please use the data to compute the class of \(x=5.5\) according to \(k=1\), \(3\), \(6\) and \(9\). Please compute everything by hand.
Solution to Exercise 2.1 (Handwritten example)
Not yet done!
Please download the titanic dataset from here
. This is the same dataset from what you dealt with in Chapter 1 Exercises. Therefore you may use the same way to prepare the data.
Please analyze the dataset and build a k-NN model to predict whether someone is survived or not. Note that you have to pick k
at the end.
Solution to Exercise 2.2
Not yet done!