From 516f83ecb47557ab6158cc101b2014154fd9dc8e Mon Sep 17 00:00:00 2001 From: Hannes Kuchelmeister Date: Tue, 4 May 2021 11:52:47 +0200 Subject: [PATCH] add mps and party plotting to UK dataset, #7 --- VotingAnalysis.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/VotingAnalysis.py b/VotingAnalysis.py index e6ef1f2..7baaa35 100644 --- a/VotingAnalysis.py +++ b/VotingAnalysis.py @@ -297,3 +297,18 @@ ax.set_zlabel('vote_2') ax.legend() plt.show() + +# predicting mp positions +prediction = sofmnet.predict(X) +print(f'prediction: {prediction}') + +# converting to x and y coordinates +ys, xs = np.unravel_index(np.argmax(X, axis=1), (h, w)) + +# plotting mps +plot_mps(data[:,0], xs, ys, data[:,1]) +plt.show() + +# plotting parties +plot_parties(xs, ys, data[:,1]) +plt.show()