Beispiel #1
0
plt.xlabel('Iteration number')
#plt.xlabel('Epoch')
plt.ylabel('Mean of W1\'s values')
plt.show()

y_b1 = b1_value
plt.plot(x, y_b1, color = "#008000")
plt.legend()
plt.xlabel('Iteration number')
#plt.xlabel('Epoch')
plt.ylabel('Mean of b1\'s values')
plt.show()

y_w2 = w2_value
plt.plot(x, y_w2, color = "#483d8b")
plt.legend()
plt.xlabel('Iteration number')
#plt.xlabel('Epoch')
plt.ylabel('Mean of W2\'s values')
plt.show()

y_b2 = b2_value
plt.plot(x, y_b2, color = "#483d8b")
plt.legend()
plt.xlabel('Iteration number')
#plt.xlabel('Epoch')
plt.ylabel('Mean of b2\'s values')
plt.show()

np.savetxt(name_sim + "_iter_{}_h_{}_{}_{}_simulated.csv".format(iters_num, hid_size, layer_num, str(int(time.time()))), network.predict(data_sim), delimiter = ',')
plt.savefig("loss_test_100.png", bbox_inches='tight')
plt.show()

y_val = test_loss
plt.plot(x, y_val, color="#ff4500")
plt.xlabel('Iteration number')
#plt.xlabel('Epoch')
plt.ylabel('Loss')
plt.ylim(0, 20)
plt.ticklabel_format(axis='y', style='sci', scilimits=(0, 0))
plt.savefig("loss_test_20.png", bbox_inches='tight')
plt.show()

for key in values:
    if (key == 'W1' or key == 'b1'):
        color = "#008000"
    elif (key == 'W2' or key == 'b2'):
        color = "#483d8b"
    elif (key == 'W3' or key == 'b3'):
        color = "#990000"
    plt.plot(x, values[key], color=color)
    plt.xlabel('Iteration number')
    plt.ylabel('Mean of {}\'s values'.format(key))
    plt.ticklabel_format(axis='y', style='sci', scilimits=(0, 0))
    plt.savefig("{}.png".format(key), bbox_inches='tight')
    plt.show()

np.savetxt(name_sim + "_iter_{}_h_{}_{}_{}_simulated.csv".format(
    iters_num, hid_size, layer_num, str(int(time.time()))),
           network.predict(data_sim),
           delimiter=',')