Homepage › Solution manuals › Yaser Abu-Mostafa › Learning from Data › Exercise 1.4
Exercise 1.4
Answers
Implement the perceptron learning algorithm and check
- Convergence speed:
The convergence is fast, it depends on the data, but usually, it only takes about 10 iterations to find a solution. - How well the final hypothesis
matches your target :
The final hypothesis doesn’t match my target very closely in terms of their coefficients. But from the picture, they are largely in line with each other in the range of data.
#perceptron(df.values, 2) lb, ub = -100, 100 N, dim = 20, 2 num_grid_points = 2000 coeff_lb, coeff_ub = -10, 10 eta = 1 maxit = 100 use_adaline, randomize = False, False _, _, _ = run_perceptron_experiment(N, dim, lb, ub, num_grid_points, coeff_lb, coeff_ub, eta, maxit, use_adaline, randomize)
final correctness: 20 . Total iteration: 2 final normalized w: [0.02354535 0.26266196 1. ] True coeffs: [2.16057234 0.3672496 1. ]
2021-12-07 18:06