| 929 | |
| 930 | |
| 931 | def plot_evolution_results(hyp): # from utils.utils import *; plot_evolution_results(hyp) |
| 932 | # Plot hyperparameter evolution results in evolve.txt |
| 933 | x = np.loadtxt('evolve.txt', ndmin=2) |
| 934 | f = fitness(x) |
| 935 | weights = (f - f.min()) ** 2 # for weighted results |
| 936 | fig = plt.figure(figsize=(12, 10)) |
| 937 | matplotlib.rc('font', **{'size': 8}) |
| 938 | for i, (k, v) in enumerate(hyp.items()): |
| 939 | y = x[:, i + 7] |
| 940 | # mu = (y * weights).sum() / weights.sum() # best weighted result |
| 941 | mu = y[f.argmax()] # best single result |
| 942 | plt.subplot(4, 5, i + 1) |
| 943 | plt.plot(mu, f.max(), 'o', markersize=10) |
| 944 | plt.plot(y, f, '.') |
| 945 | plt.title('%s = %.3g' % (k, mu), fontdict={'size': 9}) # limit to 40 characters |
| 946 | print('%15s: %.3g' % (k, mu)) |
| 947 | fig.tight_layout() |
| 948 | plt.savefig('evolve.png', dpi=200) |
| 949 | |
| 950 | |
| 951 | def plot_results_overlay(start=0, stop=0): # from utils.utils import *; plot_results_overlay() |