From 41f04e5ae4a459c0934cc7bca55e75dbbbb51b8a Mon Sep 17 00:00:00 2001 From: hedaoyuan Date: Wed, 1 Mar 2017 19:25:09 +0800 Subject: [PATCH] Add regularization and model_average --- demo/sentiment/train_with_new_api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/demo/sentiment/train_with_new_api.py b/demo/sentiment/train_with_new_api.py index 59a303c0d..bec07de92 100644 --- a/demo/sentiment/train_with_new_api.py +++ b/demo/sentiment/train_with_new_api.py @@ -160,7 +160,10 @@ if __name__ == '__main__': # create parameters parameters = paddle.parameters.create(cost) - adam_optimizer = paddle.optimizer.Adam(learning_rate=0.01) + adam_optimizer = paddle.optimizer.Adam( + learning_rate=2e-3, + regularization=paddle.optimizer.L2Regularization(rate=8e-4), + model_average=paddle.optimizer.ModelAverage(average_window=0.5)) def event_handler(event): if isinstance(event, paddle.event.EndIteration): -- GitLab