Heteroscedastic GPR¶
Two-stage learned heteroscedastic GPR for input-dependent observation noise.
matgpr.heteroscedastic_gpr
¶
HeteroscedasticGPRPrediction
dataclass
¶
Predictions from a two-stage heteroscedastic Gaussian-process model.
Attributes:
| Name | Type | Description |
|---|---|---|
mean |
ndarray
|
Predictive mean from the signal GP in original target units. |
std |
ndarray | None
|
Total predictive standard deviation in original target units,
combining latent signal uncertainty and learned observation noise. This
is |
lower, upper |
Optional lower and upper Gaussian confidence bounds built from
|
|
latent_std |
ndarray | None
|
Latent-function standard deviation from the signal GP, excluding
observation noise. This is |
noise_std |
ndarray | None
|
Learned input-dependent observation-noise standard deviation. |
noise_variance |
ndarray | None
|
Learned input-dependent observation-noise variance. |
log_noise_variance |
ndarray | None
|
Predicted log observation-noise variance from the residual-noise GP. |
Source code in matgpr/heteroscedastic_gpr.py
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 | |
HeteroscedasticGPRResult
dataclass
¶
Container returned by fit_heteroscedastic_gpr.
This model is a practical two-stage approximation:
- Fit a signal GP for the target.
- Fit a second GP to the log squared signal residuals.
The second GP learns input-dependent observation-noise variance. Prediction combines latent signal uncertainty with the learned noise variance. This is useful for materials datasets where measurement quality, synthesis route, composition region, or descriptor coverage changes across the design space. It is not a full joint variational heteroscedastic likelihood.
Source code in matgpr/heteroscedastic_gpr.py
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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
model
property
¶
Fitted signal GP model.
likelihood
property
¶
Fitted signal GP likelihood.
predict(X, *, return_std=True, confidence_level=None)
¶
Predict target values with learned input-dependent noise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
Feature matrix with the same column order used during fitting. |
required | |
return_std
|
bool
|
Whether to include total and latent predictive standard deviations. |
True
|
confidence_level
|
float | None
|
Optional central confidence level, for example |
None
|
Source code in matgpr/heteroscedastic_gpr.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
fit_heteroscedastic_gpr(X_train, y_train, *, signal_kernel='matern', noise_kernel='matern', ard=True, signal_mean_module=None, signal_lr=0.01, noise_lr=0.01, signal_training_iter=1000, noise_training_iter=500, signal_initial_noise=0.1, noise_initial_noise=0.05, standardize_y=True, standardize_noise_targets=True, residual_variance_floor=1e-08, noise_variance_floor=None, device='cpu', dtype=torch.float64, verbose=False, log_every=100)
¶
Fit a two-stage heteroscedastic Gaussian Process Regressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X_train
|
Training features and target values. Pandas, NumPy, and torch inputs are accepted. |
required | |
y_train
|
Training features and target values. Pandas, NumPy, and torch inputs are accepted. |
required | |
signal_kernel
|
str
|
Kernel names for the target signal GP and log-noise GP. Supported names
match |
'matern'
|
noise_kernel
|
str
|
Kernel names for the target signal GP and log-noise GP. Supported names
match |
'matern'
|
ard
|
bool
|
If |
True
|
signal_mean_module
|
Mean | None
|
Optional signal mean module. Pass |
None
|
signal_lr
|
float
|
Adam learning rates for the signal GP and log-noise GP. |
0.01
|
noise_lr
|
float
|
Adam learning rates for the signal GP and log-noise GP. |
0.01
|
signal_training_iter
|
int
|
Optimization iterations for the signal GP and log-noise GP. |
1000
|
noise_training_iter
|
int
|
Optimization iterations for the signal GP and log-noise GP. |
1000
|
signal_initial_noise
|
float | None
|
Optional initial Gaussian likelihood noise values for each GP. |
0.1
|
noise_initial_noise
|
float | None
|
Optional initial Gaussian likelihood noise values for each GP. |
0.1
|
standardize_y
|
bool
|
Whether to standardize target values while fitting the signal GP. |
True
|
standardize_noise_targets
|
bool
|
Whether to standardize log-noise targets while fitting the noise GP. If the log-noise targets are constant, standardization is disabled automatically. |
True
|
residual_variance_floor
|
float
|
Positive floor added to squared residuals before taking the logarithm. This protects against exact interpolation and defines the smallest learnable residual variance in original target units squared. |
1e-08
|
noise_variance_floor
|
float | None
|
Optional positive floor applied to predicted observation-noise
variances. Defaults to |
None
|
device
|
str
|
Torch device and dtype used for both GP fits. |
'cpu'
|
dtype
|
str
|
Torch device and dtype used for both GP fits. |
'cpu'
|
verbose
|
bool
|
Training logging controls passed to both GP fits. |
False
|
log_every
|
bool
|
Training logging controls passed to both GP fits. |
False
|
Source code in matgpr/heteroscedastic_gpr.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |