PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.24k stars 5.59k forks source link

API Refactorization #1392

Closed wangkuiyi closed 7 years ago

wangkuiyi commented 7 years ago

Layers: @jacquesqiao should be done in 2017-2-23

Data: should be done in 2017-2-27

Activations should be done in 2017-2-23

Event: @reyoung should be done in 2017-2-23

  • [70%]Get Strong Typed Metric From paddle::Evaluator:

    • also, there are several tiny fixes merged to develop. #1371 #1372 #1373
    • issue #1389
    • PR #1375
    • Should be done in 2017-2-23
  • [没开始]补全Event?

  • [调研]IPython 画图?

  • [没开始]其他的Demo?

qingqing01 commented 7 years ago

semantic_role_labeling出发,写API训练,一些想到的问题:

网络配置

ParameterAttribute、xx_projection等其他不在python/paddle/v2中的如何引入包。这些目前在: python/paddle/trainer_config_helpers

确实要包装成Python代码。 在 https://github.com/PaddlePaddle/Paddle/issues/1402 列了出具体要做的工作。除了上述工作,还有RNN layers相关的一些工作。 请 @jacquesqiao @luotao1 @gangliao @qingiqng 来分工。

训练

parameters 初始化问题:C++还是Python?如果是python需要提供常用初始化接口吧?

目前通过ParameterAttribute 来指定parameter的初始化方法。目前支持两种方法:Gaussian RNG 和 uniform distributed RNG。实际上有很多方法来初始化参数: http://stats.stackexchange.com/questions/47590/what-are-good-initial-weights-in-a-neural-network @reyoung @qingqing01

optimizer: 其他demo需要完善python/paddle/v2/optimizer.py内容,目前只有Adam,Adamax。

请 @qingqing01

L2-Regularization 如何设置? 5 / 8 demo有正则

v2 API已经支持了——在创建trainer的时候指定。未来可能要支持per-layer的regularization。

Testing during training event_handler需要支持

@reyoung 会来写 paddle.test 和 paddle.infer

其他

疑问:网络连接如下:

          B_cost_layer:是cost层, paddle.parameters.create(B_layer)即可训练
        / 
A_layer
        \ 
         C_layer  和 B_layer共享参数,testing用。

按照训练topology=B_cost_layer即可,topology=[B_cost_layer, C_layer]吗? 否则的话testing如何拿到C_layer的输出?

    trainer.train(train_data_reader=train_reader,
                  topology=[B_cost_layer, C_layer],
                  ...)
wangkuiyi commented 7 years ago

Testing during training:event_handler需要支持

在我脑海里,我理解你给出的例子可以这么描述:

a_layer = paddle.layer.SomeLayer()
b_cost = paddle.layer.SomeCost(a_layer)
c_cost = paddle.layer.SomeOtherCost(a_layer)

parameters = paddle.parameters.create([b_cost, c_cost])

def event_handler(event):
    if isinstande(event, paddle.event.EndIteration):
        print paddle.test(c_cost,
                   parameters,
                   paddle.dataset.mnist.testing_data())

paddle.train(b_cost,
             parameters,
             paddle.dataset.mnist.training_data(),
             event_handler)

请看这样可以吗?

reyoung commented 7 years ago

This issue has been done.