Skip to content

Commit 497af7e

Browse files
committed
Update Python tests and tutos
1 parent 96a8ddf commit 497af7e

File tree

6 files changed

+1937
-1746
lines changed

6 files changed

+1937
-1746
lines changed

doc/Egor_Tutorial.ipynb

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,10 @@
2020
},
2121
{
2222
"cell_type": "code",
23-
"execution_count": 1,
23+
"execution_count": null,
2424
"id": "1504e619-5775-42d3-8f48-7339272303ec",
2525
"metadata": {},
26-
"outputs": [
27-
{
28-
"name": "stdout",
29-
"output_type": "stream",
30-
"text": [
31-
"Requirement already satisfied: egobox in d:\\rlafage\\miniconda3\\lib\\site-packages (0.12.0)\n",
32-
"Note: you may need to restart the kernel to use updated packages.\n"
33-
]
34-
}
35-
],
26+
"outputs": [],
3627
"source": [
3728
"%pip install egobox"
3829
]
@@ -753,7 +744,7 @@
753744
"name": "python",
754745
"nbconvert_exporter": "python",
755746
"pygments_lexer": "ipython3",
756-
"version": "3.8.5"
747+
"version": "3.11.5"
757748
}
758749
},
759750
"nbformat": 4,

doc/Gpx_MaunaLoaCO2.ipynb

Lines changed: 399 additions & 560 deletions
Large diffs are not rendered by default.

doc/Gpx_Tutorial.ipynb

Lines changed: 1049 additions & 837 deletions
Large diffs are not rendered by default.

doc/SparseGpx_Tutorial.ipynb

Lines changed: 476 additions & 327 deletions
Large diffs are not rendered by default.

python/egobox/examples/kriging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
num = 100
1212
x = np.linspace(0.0, 4.0, num).reshape((-1, 1))
1313

14-
y = gpx.predict_values(x)
14+
y = gpx.predict(x)
1515
# estimated variance
16-
s2 = gpx.predict_variances(x)
16+
s2 = gpx.predict_var(x)
1717

1818
fig, axs = plt.subplots(1)
1919

python/egobox/tests/test_gpmix.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ def test_gpx_kriging(self):
2323
print(f"gpx.likelihood = {gpx.likelihoods()}")
2424

2525
# should interpolate
26-
self.assertAlmostEqual(1.0, gpx.predict_values(np.array([[1.0]])).item())
27-
self.assertAlmostEqual(0.0, gpx.predict_variances(np.array([[1.0]])).item())
26+
self.assertAlmostEqual(1.0, gpx.predict(np.array([[1.0]])).item())
27+
self.assertAlmostEqual(0.0, gpx.predict_var(np.array([[1.0]])).item())
2828

2929
# check a point not too far from a training point
3030
self.assertAlmostEqual(
31-
1.1163, gpx.predict_values(np.array([[1.1]])).item(), delta=1e-3
31+
1.1163, gpx.predict(np.array([[1.1]])).item(), delta=1e-3
3232
)
3333
self.assertAlmostEqual(
34-
0.0, gpx.predict_variances(np.array([[1.1]])).item(), delta=1e-3
34+
0.0, gpx.predict_var(np.array([[1.1]])).item(), delta=1e-3
3535
)
3636

3737
def test_gpx_save_load(self):
@@ -46,15 +46,15 @@ def test_gpx_save_load(self):
4646
os.remove(filename)
4747

4848
# should interpolate
49-
self.assertAlmostEqual(1.0, gpx2.predict_values(np.array([[1.0]])).item())
50-
self.assertAlmostEqual(0.0, gpx2.predict_variances(np.array([[1.0]])).item())
49+
self.assertAlmostEqual(1.0, gpx2.predict(np.array([[1.0]])).item())
50+
self.assertAlmostEqual(0.0, gpx2.predict_var(np.array([[1.0]])).item())
5151

5252
# check a point not too far from a training point
5353
self.assertAlmostEqual(
54-
1.1163, gpx2.predict_values(np.array([[1.1]])).item(), delta=1e-3
54+
1.1163, gpx2.predict(np.array([[1.1]])).item(), delta=1e-3
5555
)
5656
self.assertAlmostEqual(
57-
0.0, gpx2.predict_variances(np.array([[1.1]])).item(), delta=1e-3
57+
0.0, gpx2.predict_var(np.array([[1.1]])).item(), delta=1e-3
5858
)
5959

6060

0 commit comments

Comments
 (0)