Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Fit a line : 2nd fix#525

Merged
daming-lu merged 5 commits intoPaddlePaddle:high-level-api-branchfrom
daming-lu:fit_a_line_2nd_fix
Jun 1, 2018
Merged

Fit a line : 2nd fix#525
daming-lu merged 5 commits intoPaddlePaddle:high-level-api-branchfrom
daming-lu:fit_a_line_2nd_fix

Conversation

@daming-lu
Copy link
Contributor

No description provided.

@daming-lu daming-lu changed the base branch from develop to high-level-api-branch May 31, 2018 03:30
# event_handler to print training and testing info
def event_handler(event):
def event_handler_plot(event):
global step
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we still need a global step because event.step only goes 0-20 in one EndStepEvent. We need the step to keep growing. Otherwise the plot would look weird like zig-zag.

print('loss is less than 10.0, stop')
trainer.stop()

if step >= 2000:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. It takes a few minutes to converge. Only a bit longer than step == 2000

screen shot 2018-05-30 at 8 28 05 pm

# We can save the trained parameters for the inferences later
if params_folder is not None:
trainer.save_params(params_folder)
if params_dirname is not None:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed name

reader=train_reader,
num_epochs=100,
event_handler=event_handler,
event_handler=event_handler_plot,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed name

@daming-lu daming-lu merged commit fdcd800 into PaddlePaddle:high-level-api-branch Jun 1, 2018
@daming-lu daming-lu deleted the fit_a_line_2nd_fix branch June 1, 2018 00:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

1 participant