26. Sampling fromaGaussian prior process
x = -0.7
m, s = conditional([-0.7], x, y, θ)
y.append(np.random.normal(m, s))
y
[0.4967141530112327, -0.1382640378102619]
27. Sampling fromaGaussian prior process
x = [-2.1, -1.5, 0.3, 1.8, 2.5]
mu, s = conditional(x_more, x, y, θ)
y += np.random.multivariate_normal(mu, s).tolist()
y
[0.4967141530112327, -0.1382640378102619, -1.5128756 , 0.52371713,
-0.13952425, -0.93665367, -1.29343995
28.
29. Gaussian Processes in Python
» GPy
» GPflow
» scikit-learn
» PyStan
» Edward
» George
» PyMC3
30. PyMC3
» started in 2003
» PP framework for fitting
arbitrary probability models
» based on Theano
» implements "next generation"
Bayesian inference methods
» NumFOCUS sponsored project
github.com/pymc-devs/
pymc3
36. Salmon recruitmentmodel
Covariance functionand marginalGP
with salmon_model:
M = gp.mean.Linear(coeffs=(y/X).mean())
K = η * gp.cov.ExpQuad(1, ρ)
gp = gp.Marginal(mean_func=M, cov_func=K)
48. LatentGPmodel
with Model() as disasters_model:
# Hyperpriors on covariance function parameters
ρ = Exponential('ρ', 1)
η = Exponential('η', 1)
# Covariance function
K = η**2 * cov.ExpQuad(1, ρ)
# Latent GP
gp = Latent(cov_func=K)
f = gp.prior('f', X=year[:, None])
# Transform into rate parameter
λ = Deterministic('λ', exp(f))
confirmation = Poisson('confirmation', λ,
observed=disasters_data)
49. LatentGPmodel
with Model() as disasters_model:
# Hyperpriors on covariance function parameters
ρ = Exponential('ρ', 1)
η = Exponential('η', 1)
# Covariance function
K = η**2 * cov.ExpQuad(1, ρ)
# Latent GP
gp = Latent(cov_func=K)
f = gp.prior('f', X=year[:, None])
# Transform into rate parameter
λ = Deterministic('λ', exp(f))
confirmation = Poisson('confirmation', λ,
observed=disasters_data)
50. LatentGPmodel
with Model() as disasters_model:
# Hyperpriors on covariance function parameters
ρ = Exponential('ρ', 1)
η = Exponential('η', 1)
# Covariance function
K = η**2 * cov.ExpQuad(1, ρ)
# Latent GP
gp = Latent(cov_func=K)
f = gp.prior('f', X=year[:, None])
# Transform into rate parameter
λ = Deterministic('λ', exp(f))
confirmation = Poisson('confirmation', λ,
observed=disasters_data)
51. MCMC Sampling
with disasters_model:
trace = sample(1000, tune=2000)
Auto-assigning NUTS sampler...
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (2 chains in 2 jobs)
NUTS: [f_rotated_, η_log__, ρ_log__]
100%|██████████| 3000/3000 [04:04<00:00, 12.27it/s]
There were 1 divergences after tuning. Increase `target_accept` or reparameterize.
61. Posterior Covariance
!
compute time, memory
» Sparse approximation methods approximate the
posterior using a set of inducing inputs
(pseudo-inputs)
74. Gaussian Processes for Data
Science
There's more!
- GP for classification
- automatic relevance determination
- neural networks
- reinforcement learning
75. Gaussian Processes for Data
Science
Advantages:
- flexible modeling of complex, non-linear processes
- fully probabilistic predictions
- interpretable hyperparameters
- easy to automate
Limitations:
- scales poorly with large data (without
approximation)
76.
77. The PyMC3Team
» Colin Carroll
» Peadar Coyle
» Bill Engels
» Maxim Kochurov
» Junpeng Lao
» Eric Ma
» Osvaldo Martin
» Kyle Meyer
» Michael Osthege
» Austin Rochford
» Adrian Seyboldt
» Hannes Vasyura-Bathke
» Thomas Wiecki
» Taku Yoshioka