@@ -65,12 +65,12 @@ def k_posterior(self, x1: np.ndarray, x2: np.ndarray | None = None):
6565 self .k (x1 , self .x_obs ) @ self .inv @ \
6666 (self .k (self .x_obs , x1 ) if x2 is None else self .k (self .x_obs , x2 ))
6767
68- def prior (self , x : np .ndarray , n : int = 1 ) -> np .ndarray :
68+ def sample_prior (self , x : np .ndarray , n : int = 1 ) -> np .ndarray :
6969 ell = np .linalg .cholesky (self .k (x ) + NUGGET * np .eye (len (x )))
7070 return (self .mu (x )[:, None ] if n > 1 else self .mu (x )) + \
7171 ell @ np .random .normal (0 , 1 , (len (x ), n ) if n > 1 else len (x ))
7272
73- def posterior (self , x : np .ndarray , n : int = 1 ) -> tuple [np .ndarray , np .ndarray ]:
73+ def sample_posterior (self , x : np .ndarray , n : int = 1 ) -> tuple [np .ndarray , np .ndarray ]:
7474 ell = np .linalg .cholesky (self .k_posterior (x ) + NUGGET * np .eye (len (x )))
7575 return (self .mu_posterior (x )[:, None ] if n > 1 else self .mu_posterior (x )) + \
7676 ell @ np .random .normal (0 , 1 , (len (x ), n ) if n > 1 else len (x ))
@@ -139,7 +139,7 @@ def k_posterior(self, x1: np.ndarray, x2: np.ndarray | None = None):
139139 return (self .k (x1 ) if x2 is None else self .k (x1 , x2 )) - \
140140 self .k (x1 , self .x_obs ) @ self .inv @ (self .k (self .x_obs , x1 ) if x2 is None else self .k (self .x_obs , x2 ))
141141
142- def prior (self , x : np .ndarray , n : int = 1 ) -> np .ndarray :
142+ def sample_prior (self , x : np .ndarray , n : int = 1 ) -> np .ndarray :
143143 if n > 1 :
144144 sn = (len (x ) * self .cdim , n )
145145 sr = (len (x ), self .cdim , n )
@@ -152,7 +152,7 @@ def prior(self, x: np.ndarray, n: int = 1) -> np.ndarray:
152152 (ell @ np .random .normal (0 , 1 , sn )).reshape (sr )
153153 return y
154154
155- def posterior (self , x : np .ndarray , n : int = 1 ) -> tuple [np .ndarray , np .ndarray ]:
155+ def sample_posterior (self , x : np .ndarray , n : int = 1 ) -> tuple [np .ndarray , np .ndarray ]:
156156 if n > 1 :
157157 sn = (len (x ) * self .cdim , n )
158158 sr = (len (x ), self .cdim , n )
0 commit comments