analistica/ex-7/iters/iter.py
Giù Marcer 7ad45a829e ex-7: revised and typo-fixed
In addition, the folder ex-7/iters was created in order to plot the results
of the Perceptron method as a function of the iterations parameter.
2020-07-05 11:35:57 +02:00

26 lines
458 B
Python

#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
iter, w_x, w_y, b = np.loadtxt('ex-7/iters/iters.txt')
plt.figure(figsize=(5, 4))
plt.rcParams['font.size'] = 8
plt.subplot(211)
plt.title('weight vector', loc='right')
plt.plot(iter, w, color='#92182b')
plt.ylabel('w')
plt.xlabel('N')
plt.subplot(212)
plt.title('bias', loc='right')
plt.plot(iter, b, color='gray')
plt.ylabel('b')
plt.xlabel('N')
plt.tight_layout()
plt.show()