You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.nn.ProximalAdagrad.rst 3.0 kB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. mindspore.nn.ProximalAdagrad
  2. ==============================
  3. .. py:class:: mindspore.nn.ProximalAdagrad(*args, **kwargs)
  4. ProximalAdagrad算法的实现。
  5. ProximalAdagrad用于在线学习和随机优化。
  6. 请参阅论文 `Efficient Learning using Forward-Backward Splitting <http://papers.nips.cc//paper/3793-efficient-learning-using-forward-backward-splitting.pdf>`_。
  7. .. math::
  8. accum_{t+1} = accum_{t} + g * g
  9. .. math::
  10. \text{prox_v} = w_{t} - \gamma * g * \frac{1}{\sqrt{accum_{t+1}}}
  11. .. math::
  12. w_{t+1} = \frac{sign(\text{prox_v})}{1 + \gamma * l2} * \max(\left| \text{prox_v} \right| - \gamma * l1, 0)
  13. 其中, :math:`g` 、 :math:`\gamma` 、 :math:`w` 、 :math:`accum` 和 :math:`t` 分别表示 `grads` 、 `learning_rate` 、 `params` 、累加器和当前step。
  14. .. note::
  15. .. include:: mindspore.nn.optim_note_sparse.rst
  16. .. include:: mindspore.nn.optim_note_weight_decay.rst
  17. **参数:**
  18. - **params** (Union[list[Parameter], list[dict]]) - 必须是 `Parameter` 组成的列表或字典组成的列表。当列表元素是字典时,字典的键可以是"params"、"lr"、"weight_decay"、"grad_centralization"和"order_params":
  19. .. include:: mindspore.nn.optim_group_param.rst
  20. .. include:: mindspore.nn.optim_group_lr.rst
  21. .. include:: mindspore.nn.optim_group_dynamic_weight_decay.rst
  22. .. include:: mindspore.nn.optim_group_gc.rst
  23. .. include:: mindspore.nn.optim_group_order.rst
  24. - **accum** (float) - 累加器 `accum` 的初始值,起始值必须为零或正值。默认值:0.1。
  25. - **learning_rate** (Union[float, Tensor, Iterable, LearningRateSchedule]): 默认值:1e-3。
  26. .. include:: mindspore.nn.optim_arg_dynamic_lr.rst
  27. - **l1** (float):l1正则化强度,必须大于或等于零。默认值:0.0。
  28. - **l2** (float):l2正则化强度,必须大于或等于零。默认值:0.0。
  29. - **use_locking** (bool) - 如果为True,则更新操作使用锁保护。默认值:False。
  30. .. include:: mindspore.nn.optim_arg_loss_scale.rst
  31. - **weight_decay** (Union[float, int, Cell]) - 权重衰减(L2 penalty)。默认值:0.0。
  32. .. include:: mindspore.nn.optim_arg_dynamic_wd.rst
  33. **输入:**
  34. - **grads** (tuple[Tensor]) - 优化器中 `params` 的梯度,shape与优化器中的 `params` 相同。
  35. **输出:**
  36. Tensor[bool],值为True。
  37. **异常:**
  38. - **TypeError** - `learning_rate` 不是int、float、Tensor、Iterable或LearningRateSchedule。
  39. - **TypeError** - `parameters` 的元素不是Parameter或字典。
  40. - **TypeError** - `accum`、`l1`、`l2` 或 `loss_scale` 不是float。
  41. - **TypeError** - `weight_decay` 不是float或int。
  42. - **ValueError** - `loss_scale` 小于或等于0。
  43. - **ValueError** - `accum`、`l1`、`l2` 或 `weight_decay` 小于0。
  44. .. include:: mindspore.nn.optim_target_unique_for_sparse.rst