Skip to content

Commit 80b2021

Browse files
committed
Update coregion model notebook
1 parent 3c470b2 commit 80b2021

File tree

2 files changed

+285
-322
lines changed

2 files changed

+285
-322
lines changed

examples/gaussian_processes/MOGP-Coregion-Hadamard.ipynb

Lines changed: 267 additions & 320 deletions
Large diffs are not rendered by default.

examples/gaussian_processes/MOGP-Coregion-Hadamard.myst.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupytext:
55
format_name: myst
66
format_version: 0.13
77
kernelspec:
8-
display_name: Python 3 (ipykernel)
8+
display_name: default
99
language: python
1010
name: python3
1111
---
@@ -26,6 +26,20 @@ This notebook shows how to implement the **Intrinsic Coregionalization Model** (
2626
The advantage of Multi-output Gaussian Processes is their capacity to simultaneously learn and infer many outputs which have the same source of uncertainty from inputs. In this example, we model the average spin rates of several pitchers in different games from a baseball dataset.
2727

2828
```{code-cell} ipython3
29+
import os
30+
31+
32+
def set_omp_num_threads():
33+
"""Sets the OMP_NUM_THREADS environment variable to 1."""
34+
os.environ["OMP_NUM_THREADS"] = "1"
35+
36+
37+
set_omp_num_threads()
38+
```
39+
40+
```{code-cell} ipython3
41+
import warnings
42+
2943
import arviz as az
3044
import matplotlib.pyplot as plt
3145
import numpy as np
@@ -34,6 +48,8 @@ import pymc as pm
3448
import pytensor.tensor as pt
3549
3650
from pymc.gp.util import plot_gp_dist
51+
52+
warnings.filterwarnings("ignore", category=FutureWarning, module="pytensor.tensor.blas")
3753
```
3854

3955
```{code-cell} ipython3
@@ -93,7 +109,7 @@ adf["avg_spin_rate"].describe()
93109

94110
```{code-cell} ipython3
95111
# There are 142 game dates from 01 Apr 2021 to 03 Oct 2021.
96-
adf.loc[:, "game_date"] = pd.to_datetime(adf.loc[:, "game_date"])
112+
adf["game_date"] = pd.to_datetime(adf["game_date"])
97113
game_dates = adf.loc[:, "game_date"]
98114
game_dates.min(), game_dates.max(), game_dates.nunique(), (game_dates.max() - game_dates.min())
99115
```

0 commit comments

Comments
 (0)