MultiMean
gpplus.means.multi_mean.MultiMean
¤
Bases: Mean
A mean function for grouped / multi-fidelity data.
Each source (fidelity level) has its own mean module. At forward time the source of each input row is read from a one-hot block of columns, and the appropriate per-source mean is applied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_cols
|
list[int]
|
Column indices of the one-hot encoded source block in the input
tensor. |
required |
means
|
list[Mean]
|
One mean module per source. If None, the first source defaults to
|
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
source_cols |
list[int]
|
Stored one-hot column indices. |
num_sources |
int
|
Number of fidelity sources (== |
means |
ModuleList
|
Per-source mean modules, registered as
submodules so parameters are tracked, moved with |
Example
3 fidelities, one-hot encoded in columns 10, 11, 12¤
mm = MultiMean(source_cols=[10, 11, 12])
Or with explicit per-source means:¤
mm = MultiMean( ... source_cols=[10, 11, 12], ... means=[ZeroMean(), ConstantMean(), ConstantMean()], ... )
Source code in gpplus/means/multi_mean.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
source_cols = list(source_cols)
instance-attribute
¤
num_sources = len(self.source_cols)
instance-attribute
¤
means = nn.ModuleList(means)
instance-attribute
¤
__init__(source_cols, means=None)
¤
Source code in gpplus/means/multi_mean.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
forward(x)
¤
Apply the per-source mean to each row of x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor of shape |
required |
Returns:
| Type | Description |
|---|---|
|
Tensor of shape |
Source code in gpplus/means/multi_mean.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |