OffsetMean

class glimix_core.mean.OffsetMean(n)[source]

Offset mean function, θ⋅𝟏.

It represents a mean vector 𝐦 = θ⋅𝟏 of size n. The offset is given by the parameter θ.

Example

>>> from glimix_core.mean import OffsetMean
>>>
>>> mean = OffsetMean(3)
>>> mean.offset = 2.0
>>> print(mean.value())
[2. 2. 2.]
>>> print(mean.gradient())
{'offset': array([1., 1., 1.])}
>>> mean.name = "𝐦"
>>> print(mean)
OffsetMean(): 𝐦
  offset: 2.0
__init__(n)[source]

Constructor.

Parameters

n (int) – Size of the 𝟏 array.

Methods

__init__(n)

Constructor.

fix_offset()

Prevent θ update during optimization.

gradient()

Gradient of the offset function.

unfix_offset()

Enable θ update during optimization.

value()

Offset mean.

Attributes

name

Name of this function.

offset

Offset parameter.