regularizer_cn.rst 1.9 KB
Newer Older
H
1207  
Hao Wang 已提交
1
###################
T
Tink_Y 已提交
2
 fluid.regularizer
H
1207  
Hao Wang 已提交
3 4 5 6 7 8 9 10 11 12
###################

.. _cn_api_fluid_regularizer_L1Decay:

L1Decay
-------------------------------

.. py:attribute::   paddle.fluid.regularizer.L1Decay

``L1DecayRegularizer`` 的别名
T
Tink_Y 已提交
13 14 15 16 17 18



.. _cn_api_fluid_regularizer_L1DecayRegularizer:

L1DecayRegularizer
H
1207  
Hao Wang 已提交
19
-------------------------------
T
Tink_Y 已提交
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

.. py:class:: paddle.fluid.regularizer.L1DecayRegularizer(regularization_coeff=0.0)

实现 L1 权重衰减正则化。

L1正则将会稀疏化权重矩阵。


.. math::
            \\L1WeightDecay=reg\_coeff∗sign(parameter)\\

参数:
  - **regularization_coeff** (float) – 正则化系数
  
**代码示例**

..  code-block:: python
    
    ioptimizer = fluid.optimizer.Adagrad(
                            learning_rate=1e-4,
                            regularization=fluid.regularizer.L1DecayRegularizer(
                             regularization_coeff=0.1))
    optimizer.minimize(avg_cost)
    
  
  


H
1207  
Hao Wang 已提交
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62



.. _cn_api_fluid_regularizer_L2Decay:

L2Decay
-------------------------------

.. py:attribute::   paddle.fluid.regularizer.L2Decay

``L2DecayRegularizer`` 的别名




T
Tink_Y 已提交
63 64 65 66

.. _cn_api_fluid_regularizer_L2DecayRegularizer:

L2DecayRegularizer
H
1207  
Hao Wang 已提交
67
-------------------------------
T
Tink_Y 已提交
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92

.. py:class:: paddle.fluid.regularizer.L2DecayRegularizer(regularization_coeff=0.0)

实现L2 权重衰减正则化。 

较小的 L2 的有助于防止对训练数据的过度拟合。

.. math::
            \\L2WeightDecay=reg\_coeff*parameter\\

参数:
  - **regularization_coeff** (float) – 正则化系数
  
**代码示例**

..  code-block:: python
    
   optimizer = fluid.optimizer.Adagrad(
                            learning_rate=1e-4,
                            regularization=fluid.regularizer.L2DecayRegularizer(
                            regularization_coeff=0.1))
    optimizer.minimize(avg_cost)



H
1207  
Hao Wang 已提交
93 94 95



T
Tink_Y 已提交
96