Skip to content

Commit 283a3a8

Browse files
committed
Update: API rename
1 parent 61374ef commit 283a3a8

12 files changed

Lines changed: 30 additions & 30 deletions

File tree

doc/Lee2010.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
" term = np.exp(-c * x)\n",
5151
" return a * 1.2 * c * term\n",
5252
"\n",
53-
" def estimate(\n",
53+
" def prior(\n",
5454
" self,\n",
5555
" x: np.ndarray | None = None,\n",
5656
" y: np.ndarray | None = None,\n",
@@ -90,7 +90,7 @@
9090
" term = 1.0 / (c + x)\n",
9191
" return -b * term * term\n",
9292
"\n",
93-
" def estimate(\n",
93+
" def prior(\n",
9494
" self,\n",
9595
" x: np.ndarray | None = None,\n",
9696
" y: np.ndarray | None = None,\n",

test/oceancolour/test_ocx.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_ci(self):
4848
f = CI()
4949
x = np.stack([W[:, [1, 4, 5]], R[:, [1, 4, 5]]], axis=1)
5050
u = np.stack([np.broadcast_to(0.5, (M, 3)), u[:, [1, 4, 5]]], axis=1)
51-
p = f.estimate()
51+
p = f.prior()
5252
y = f.eval(p, x)
5353

5454
self.assertEqual((M,), y.shape)
@@ -98,7 +98,7 @@ def test_oc4(self):
9898
f = OC4()
9999
x = R[:, 1:-1]
100100
u = u[:, 1:-1]
101-
p = f.estimate()
101+
p = f.prior()
102102
y = f.eval(p, x)
103103

104104
self.assertEqual((M,), y.shape)
@@ -147,7 +147,7 @@ def test_oci(self):
147147
f = OCI()
148148
x = np.stack([W[:, 1:], R[:, 1:]], axis=1)
149149
u = np.stack([np.broadcast_to(0.5, (M, 5)), u[:, 1:]], axis=1)
150-
p = f.estimate()
150+
p = f.prior()
151151
y = f.eval(p, x)
152152

153153
self.assertEqual((M,), y.shape)

test/oceancolour/test_qaa.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def test_qaa_single_batch_case_1(self):
247247

248248
f = QAA()
249249
x = np.stack([W, R, AW, BW], axis=1)
250-
p = f.estimate(preset="case1")
250+
p = f.prior(preset="case1")
251251
y = f.eval(p, x)
252252

253253
a = y[0, 0]
@@ -274,7 +274,7 @@ def test_qaa_single_batch_case_2(self):
274274

275275
f = QAA()
276276
x = np.stack([W, R, AW, BW], axis=1)
277-
p = f.estimate(preset="case2")
277+
p = f.prior(preset="case2")
278278
y = f.eval(p, x)
279279

280280
a = y[0, 0]
@@ -309,7 +309,7 @@ def test_qaa_multiple_batches(self):
309309
],
310310
axis=1,
311311
)
312-
p = f.estimate()
312+
p = f.prior()
313313
y = f.eval(p, x)
314314

315315
A, _, n = read_test_data("test.resources", "a.csv") # noqa: N806
@@ -351,7 +351,7 @@ def test_apply_qaa_to_owt_classes(self):
351351
],
352352
axis=1,
353353
)
354-
p = f.estimate()
354+
p = f.prior()
355355
y = f.eval(p, x)
356356
self.assertEqual((M, 4, m), y.shape)
357357

uncertaintyx/fit/eiv/jax.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def fit(
308308
"""
309309
popt, pcov, punc, cost, converged = evm(
310310
f.f,
311-
jnp.asarray(f.estimate(x, y)),
311+
jnp.asarray(f.prior(x, y)),
312312
jnp.asarray(x),
313313
jnp.asarray(y),
314314
jnp.square(ux) if ux is not None else None,

uncertaintyx/fit/eiv/numpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def jac_x(x: np.ndarray, p: np.ndarray) -> np.ndarray:
9797
"""Wrap for external API compliance."""
9898
return t(r(f.jac_x(u(p, k_u), u(x.T, m_u)), n_r + m_r))
9999

100-
p = f.estimate(x, y)
100+
p = f.prior(x, y)
101101

102102
k_u = p.shape
103103
m_u = x.shape

uncertaintyx/fit/randomsampling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def zvar():
101101
"""
102102
return np.var(f.eval(mean, x) - y, axis=0, ddof=mean.size)
103103

104-
popt = np.full((self._how_many, len(f.estimate())), np.nan)
104+
popt = np.full((self._how_many, len(f.prior())), np.nan)
105105
cost = np.full(self._how_many, np.nan)
106106
success_count = 0
107107

@@ -219,7 +219,7 @@ def zvar():
219219
"""
220220
return np.var(f.eval(mean, x) - y, axis=0, ddof=mean.size)
221221

222-
popt = np.full((self._how_many, len(f.estimate())), np.nan)
222+
popt = np.full((self._how_many, len(f.prior())), np.nan)
223223
cost = np.full(self._how_many, np.nan)
224224
success_count = 0
225225

uncertaintyx/m/jax.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def f(p, x):
289289

290290
super().__init__(f)
291291

292-
def estimate(
292+
def prior(
293293
self,
294294
x: np.ndarray | None = None,
295295
y: np.ndarray | None = None,
@@ -311,7 +311,7 @@ def f(p, x):
311311

312312
super().__init__(f)
313313

314-
def estimate(
314+
def prior(
315315
self,
316316
x: np.ndarray | None = None,
317317
y: np.ndarray | None = None,

uncertaintyx/m/numpy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def jac_x(self, p: np.ndarray, x: np.ndarray) -> np.ndarray:
7171
a, b, _ = p
7272
return a * b * np.exp(b * x)
7373

74-
def estimate(
74+
def prior(
7575
self,
7676
x: np.ndarray | None = None,
7777
y: np.ndarray | None = None,
@@ -100,7 +100,7 @@ def jac_x(self, p, x: np.ndarray) -> np.ndarray:
100100
a, _ = p
101101
return np.full_like(x, a)
102102

103-
def estimate(
103+
def prior(
104104
self,
105105
x: np.ndarray | None = None,
106106
y: np.ndarray | None = None,

uncertaintyx/m/torch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def f(p, x):
302302

303303
super().__init__(f)
304304

305-
def estimate(
305+
def prior(
306306
self,
307307
x: np.ndarray | None = None,
308308
y: np.ndarray | None = None,
@@ -324,7 +324,7 @@ def f(p, x):
324324

325325
super().__init__(f)
326326

327-
def estimate(
327+
def prior(
328328
self,
329329
x: np.ndarray | None = None,
330330
y: np.ndarray | None = None,

uncertaintyx/oceancolour/ocx.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def convert(x, c):
113113

114114
super().__init__(f)
115115

116-
def estimate(
116+
def prior(
117117
self,
118118
x: np.ndarray | None = None,
119119
y: np.ndarray | None = None,
@@ -160,7 +160,7 @@ def f(p, x):
160160

161161
super().__init__(f)
162162

163-
def estimate(
163+
def prior(
164164
self,
165165
x: np.ndarray | None = None,
166166
y: np.ndarray | None = None,
@@ -282,7 +282,7 @@ def blend(p, ci, cx):
282282

283283
super().__init__(f)
284284

285-
def estimate(
285+
def prior(
286286
self,
287287
x: np.ndarray | None = None,
288288
y: np.ndarray | None = None,
@@ -311,7 +311,7 @@ def estimate(
311311
return np.concatenate(
312312
(
313313
np.array([0.25, 0.35]),
314-
self.m_ci.estimate(x, y),
315-
self.m_oc.estimate(x, y, preset),
314+
self.m_ci.prior(x, y),
315+
self.m_oc.prior(x, y, preset),
316316
)
317317
)

0 commit comments

Comments
 (0)