-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_generator.py
37 lines (28 loc) · 955 Bytes
/
plot_generator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import json
import matplotlib.pyplot as plt
import numpy as np
def plot_gen_alg():
with open("src/data/json/gen/2021-03-25--23-33-10.json", "r") as json_file:
data = json.load(json_file)
means = []
gens = []
for i in data:
print(i)
means.append(i["best_fitness"])
gens.append(i["current_generation"])
plt.plot(gens, means)
plt.title("Evolução do Melhor Fitness por Geração")
plt.xlabel("Gerações")
plt.ylabel("Melhor Fitness (%)")
plt.show()
def plot_validation():
with open("src/data/json/validation.json", "r") as json_file:
data = json.load(json_file)
labels = ['Média', 'Mediana']
stats = [i["result"] for i in data[-1]["validation_results"]]
figure = plt.figure()
axes = figure.add_axes([0, 0, 1, 1])
axes.bar(["a"], [3])
plt.show()
if __name__ == "__main__":
plot_validation()