Homepage › Solution manuals › Yaser Abu-Mostafa › Learning from Data › Exercise 2.6
Exercise 2.6
Answers
- (a)
- Apply the error bar in ,
i.e. .
The following calculation shows that error on and error on . So the error bar on in-sample error is higher than the error bar from test error. - (b)
- If we reserve more examples for testing, then we’ll have less samples for training. We may end up with a hypothesis that is not as good as we could have arrived if using more training samples. So might be way too off even the error bar on it is small.
import numpy as np epsilon = 0.05 N = 200 # test bound print('test bound: ', np.sqrt(np.log(2/epsilon)/2/N)) # train bound M = 1000 N = 400 print('train bound: ', np.sqrt(np.log(2*M/epsilon)/2/N))
test bound: 0.09603227913199208 train bound: 0.11509037065006825
2021-12-07 22:06