Skip to content

Commit f2b03d8

Browse files
committed
Compute S with more generic formula for radius
1 parent 2a528f9 commit f2b03d8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pymc/gp/hsgp_approx.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
TensorLike = np.ndarray | pt.TensorVariable
3131

3232

33-
def set_boundary(Xs: TensorLike, c: numbers.Real | TensorLike) -> np.ndarray:
34-
"""Set the boundary using the `Xs` and `c`. `Xs` must be centered around zero, and `c`
35-
is usually a scalar multiplier greater than 1.0, but it may also be one value per dimension
36-
or column of `Xs`.
33+
def set_boundary(X: TensorLike, c: numbers.Real | TensorLike) -> np.ndarray:
34+
"""Set the boundary using `X` and `c`. `X` can be centered around zero but doesn't have to be,
35+
and `c` is usually a scalar multiplier greater than 1.0, but it may also be one value per
36+
dimension or column of `X`.
3737
"""
38-
S = pt.max(
39-
pt.abs(Xs), axis=0
40-
) # important: the Xs should have previously been centered around 0
38+
# compute radius. Works whether X is 0-centered or not
39+
S = (pt.max(X, axis=0) - pt.min(X, axis=0)) / 2.0
40+
4141
L = (c * S).eval() # eval() makes sure L is not changed with out-of-sample preds
4242
return L
4343

0 commit comments

Comments
 (0)