-
Notifications
You must be signed in to change notification settings - Fork 8
/
plot_model.py
49 lines (37 loc) · 972 Bytes
/
plot_model.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
38
39
40
41
42
43
44
45
46
47
48
49
import matplotlib.pyplot as plt
import numpy
import data_loader as dl
# Predict
def predict(model, inputs):
values = numpy.array(inputs)
v = model.predict(values.reshape(1, 2))
return v
def plot_paths(paths):
for path in paths:
X = []
Y = []
for point in path:
X.append(point[0])
Y.append(point[1])
plt.plot(X, Y)
return
def plot(model, history, train_inputs, train_paths):
plt.figure(1)
plt.title('user input')
plot_paths(train_paths)
plt.figure(2)
size = train_inputs.__len__()
for x in range(size):
v = train_inputs[x]
paths = predict(model, v)
plot_paths(paths)
plt.title('generated')
plt.figure(3)
plt.title('accuracy')
plt.plot(history.history['acc'])
plt.plot(history.history['loss'])
plt.ylabel('value')
plt.xlabel('epoch')
plt.legend(['acc', 'loss'], loc='upper left')
plt.show()
return