From 8550540ad867a98b945934069aa4ce87f1ecf767 Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Wed, 7 Nov 2018 14:59:31 +0000 Subject: Use reconstruction error in alt method --- train.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/train.py b/train.py index bcf921c..917c895 100755 --- a/train.py +++ b/train.py @@ -112,9 +112,10 @@ def test_model(M, faces_train, faces_test, target_train, target_test, args): faces_test = np.dot(faces_test, e_vecs.T) distances = np.zeros(faces_test.shape[0]) - for i in range(faces_test.shape[0]): - norm = LA.norm(faces_train - np.tile(faces_test[i], (faces_train.shape[0], 1)), axis=1) - distances[i] = np.amin(norm) + + + rec_vecs = np.add(np.tile(average_face, (faces_test.shape[0], 1)), np.dot(faces_test, e_vecs) * deviations_tr) + distances = LA.norm(raw_faces_test - rec_vecs, axis=1); if args.reconstruct: rec_vec = np.add(average_face, np.dot(faces_train[args.reconstruct], e_vecs) * deviations_tr) -- cgit v1.2.3-54-g00ecf