aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasil Zlatanov <vasil@netcraft.com>2018-11-14 23:28:29 +0000
committerVasil Zlatanov <vasil@netcraft.com>2018-11-14 23:28:29 +0000
commita9f466bfb2dd3179984fa89b925574b3494e9223 (patch)
treee4e8789089cd433071505c2cbe9669e08a3cf80c
parent36347903e33f17841bfe083204a7b5c4013e3074 (diff)
downloadvz215_np1915-a9f466bfb2dd3179984fa89b925574b3494e9223.tar.gz
vz215_np1915-a9f466bfb2dd3179984fa89b925574b3494e9223.tar.bz2
vz215_np1915-a9f466bfb2dd3179984fa89b925574b3494e9223.zip
Use correct split when doing reigen
-rwxr-xr-xtrain.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/train.py b/train.py
index 9bfef52..dd3633f 100755
--- a/train.py
+++ b/train.py
@@ -251,17 +251,17 @@ def main():
target_pred, distances[i] = test_model(args.eigen, faces_train[i], faces_test, target_train[i], target_test, args)
target_pred = np.argmin(distances, axis=0)
elif args.reigen:
- target_pred = np.zeros((args.reigen-args.eigen, 2*n_faces))
- accuracy = np.zeros((args.reigen-args.eigen, 2*n_faces))
- rec_error = np.zeros((args.reigen-args.eigen, 2*n_faces))
+ target_pred = np.zeros((args.reigen-args.eigen, target_test.shape[0]))
+ accuracy = np.zeros(args.reigen-args.eigen)
+ rec_error = np.zeros((args.reigen-args.eigen, target_test.shape[0]))
for M in range(args.eigen, args.reigen):
start = timer()
- target_pred[i], rec_error[M - args.eigen] = test_model(M, faces_train, faces_test, target_train, target_test, args)
+ target_pred[M - args.eigen], rec_error[M - args.eigen] = test_model(M, faces_train, faces_test, target_train, target_test, args)
end = timer()
print("Run with", M, "eigenvalues completed in ", end-start, "seconds")
print("Memory Used:", psutil.Process(os.getpid()).memory_info().rss)
- accuracy[i] = accuracy_score(target_test, target_pred[i])
+ accuracy[M - args.eigen] = accuracy_score(target_test, target_pred[M-args.eigen])
# Plot
print('Max efficiency of ', max(accuracy), '% for M =', np.argmax(accuracy))
plt.plot(range(args.eigen, args.reigen), 100*accuracy)