From bc9544dee8837c9b2c05d799ada45f4cf0bfc025 Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Thu, 18 Oct 2018 18:32:39 +0100 Subject: Fix plot for large M --- train.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/train.py b/train.py index b76f5e2..134b70a 100755 --- a/train.py +++ b/train.py @@ -42,7 +42,7 @@ M = args.eigen raw_faces = genfromtxt(args.data, delimiter=',') targets = np.repeat(np.arange(10),52) -faces_train, faces_test, target_train, target_test = train_test_split(raw_faces, targets, test_size=0.5, random_state=0) +faces_train, faces_test, target_train, target_test = train_test_split(raw_faces, targets, test_size=0.2, random_state=0) # This remove the mean and scales to unit variance @@ -65,7 +65,7 @@ else: # Plot the variances (eigenvalues) from the pca object if args.graph: - plt.bar(np.arange(M), explained_variances) + plt.bar(np.arange(explained_variances.size), explained_variances) plt.ylabel('Varaiance ratio');plt.xlabel('Face Number') plt.show() -- cgit v1.2.3-54-g00ecf