PositivePrior

Adds a positive constraint on the weights of a Linear layer.

If the Linear layer has intercepts, the constraint won't apply to them.

This is implemented as a proximal operator during SGD.

Constructors

this
this()
Undocumented in source.
this
this(float eps)
Undocumented in source.

Members

Functions

dup
ProxyLinearPrior dup()
Undocumented in source. Be warned that the author may not have intended to support it.
proxy_step
void proxy_step()
Undocumented in source. Be warned that the author may not have intended to support it.
register
void register(Linear layer)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixins

__anonymous
mixin opCallNew
Undocumented in source.

Variables

_eps
float _eps;
Undocumented in source.
_ind_start
size_t _ind_start;
Undocumented in source.

Mixed In Members

From mixin opCallNew

opCall
auto opCall(T args)
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From ProxyLinearPrior

proxy_step
void proxy_step()
Undocumented in source.
dup
ProxyLinearPrior dup()
Undocumented in source.

Examples

// force weights to be positive:
auto l1 = Linear(5).prior(PositivePrior());

// force weights to be above 1e-3:
auto l2 = Linear(10).prior(PositivePrior(1e-3));

Meta