SumMeanΒΆ

class glimix_core.mean.SumMean(means)[source]ΒΆ

Sum mean function, πŸβ‚€ + πŸβ‚ + ….

The mathematical representation is

𝐦 = πŸβ‚€ + πŸβ‚ + …

In other words, it is a sum of mean vectors.

Example

>>> from glimix_core.mean import OffsetMean, LinearMean, SumMean
>>>
>>> X = [[5.1, 1.0],
...      [2.1, -0.2]]
>>>
>>> mean0 = LinearMean(X)
>>> mean0.effsizes = [-1.0, 0.5]
>>>
>>> mean1 = OffsetMean(2)
>>> mean1.offset = 2.0
>>>
>>> mean = SumMean([mean0, mean1])
>>>
>>> print(mean.value())
[-2.6 -0.2]
>>> g = mean.gradient()
>>> print(g["SumMean[0].effsizes"])
[[ 5.1  1. ]
 [ 2.1 -0.2]]
>>> print(g["SumMean[1].offset"])
[1. 1.]
>>> mean0.name = "A"
>>> mean1.name = "B"
>>> mean.name = "A+B"
>>> print(mean)
SumMean(means=...): A+B
  LinearMean(m=2): A
    effsizes: [-1.   0.5]
  OffsetMean(): B
    offset: 2.0
__init__(means)[source]ΒΆ

Constructor.

Parameters

means (list) – List of mean functions.

Methods

__init__(means)

Constructor.

gradient()

Sum of mean function derivatives.

value()

Sum of mean vectors, πŸβ‚€ + πŸβ‚ + ….

Attributes

name

Name of this function.