Skip to content

Commit

Permalink
make stop if score unchanged an option in iterative_refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdidc committed Dec 27, 2016
1 parent ee51a99 commit 64d5e70
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion machinedesign/autoencoder/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def _iterative_refinement(params, model, folder):
noise_name = noise['name']
noise_params = noise['params']

stop_if_unchanged = params['stop_if_unchanged']
seed = params['seed']

# Initialize the reconstructions
Expand Down Expand Up @@ -107,7 +108,7 @@ def _iterative_refinement(params, model, folder):
X[:, i] = inverse_transform_one(s, transformers)
score = float(np.abs(X[:, i] - X[:, i - 1]).mean())
print('Mean absolute error : {:.5f}'.format(score))
if previous_score and score == previous_score:
if previous_score and score == previous_score and stop_if_unchanged:
print('Stopping at iteration {}/{} because score did not change'.format(i, nb_iter))
X = X[:, 0:i+1]
break
Expand Down

0 comments on commit 64d5e70

Please sign in to comment.