lecture 14
play

Lecture 14 Covariance Functions 3/08/2018 1 More on Covariance - PowerPoint PPT Presentation

Lecture 14 Covariance Functions 3/08/2018 1 More on Covariance Functions 2 Nugget Covariance 3 ( , ) = 2 1 {=0} where = | | 2 1.00 1 0.75 draw 0 Draw 1 C


  1. Lecture 14 Covariance Functions 3/08/2018 1

  2. More on Covariance Functions 2

  3. Nugget Covariance 3 ๐ท๐‘๐‘ค(๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) = ๐œ 2 1 {โ„Ž=0} where โ„Ž = |๐‘ข ๐‘— โˆ’ ๐‘ข ๐‘˜ | 2 1.00 1 0.75 draw 0 Draw 1 C 0.50 y Draw 2 โˆ’1 0.25 โˆ’2 0.00 0 5 10 15 20 0 5 10 15 20 h x

  4. (- / Power / Square) Exponential Covariance 4 ๐ท๐‘๐‘ค(๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) = ๐œ 2 exp (โˆ’(โ„Ž ๐‘š) ๐‘ž ) where โ„Ž = |๐‘ข ๐‘— โˆ’ ๐‘ข ๐‘˜ | Covariance โˆ’ l=12, sigma2=1 Exponential 1.00 Cov 2 0.75 Exp 0 C 0.50 y Pow Exp (p=1.5) 0.25 Sq Exp โˆ’2 0.00 โˆ’4 0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00 h x Powered Exponential (p=1.5) Square Exponential 1 2 0 0 y y โˆ’1 โˆ’2 โˆ’2 โˆ’3 0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00 x x

  5. Matern Covariance โˆš 2๐œ‰ โ„Ž โ‹… ๐‘š) where โ„Ž = |๐‘ข ๐‘— โˆ’๐‘ข ๐‘˜ | 5 2๐œ‰ โ„Ž โ‹… ๐‘š) โˆš ๐œ‰ ๐ฟ ๐œ‰ ( ๐ท๐‘๐‘ค(๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) = ๐œ 2 2 1โˆ’๐œ‰ ฮ“(๐œ‰) ( Covariance โˆ’ l=2, sigma2=1 Matern โˆ’ v=1/2 1.00 2 0.75 1 v=1/2 C 0.50 y 0 v=3/2 โˆ’1 v=5/2 0.25 โˆ’2 0.00 0 2 4 6 0 2 4 6 h x Matern โˆ’ v=3/2 Matern โˆ’ v=5/2 1 2 0 1 y y โˆ’1 0 โˆ’2 โˆ’1 โˆ’3 0 2 4 6 0 2 4 6 x x

  6. Matern Covariance โ€ข A Gaussian process with Matรฉrn covariance has sample functions that are โŒˆ๐œ‰ โˆ’ 1โŒ‰ times differentiable. (product of an exponential and a polynomial of order ๐‘ž ). โ€ข When ๐œ‰ = 1/2 the Matern is equivalent to the exponential covariance. โ€ข As ๐œ‰ โ†’ โˆž the Matern converges to the square exponential covariance. โ€ข A Gaussian process with Matรฉrn covariance has paths that are โŒˆ๐œ‰โŒ‰ โˆ’ 1 times differentiable. 6 โ€ข ๐ฟ ๐œ‰ is the modified Bessel function of the second kind. โ€ข When ๐œ‰ = 1/2 + ๐‘ž for ๐‘ž โˆˆ N + then the Matern has a simplified form

  7. Rational Quadratic Covariance โˆ’๐›ฝ 7 ) ๐›ฝ ๐ท๐‘๐‘ค(๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) = ๐œ 2 (1 + โ„Ž 2 ๐‘š 2 where โ„Ž = |๐‘ข ๐‘— โˆ’ ๐‘ข ๐‘˜ | Covariance โˆ’ l=12, sigma2=1 Rational Quadratic โˆ’ alpha=1 1.00 1 0.75 0 alpha=1 0.50 y alpha=3 โˆ’1 alpha=10 0.25 โˆ’2 0.00 0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00 h x Rational Quadratic โˆ’ alpha=10 Rational Quadratic โˆ’ alpha=100 2 1 1 y y 0 0 โˆ’1 โˆ’1 0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00 x x

  8. Rational Quadratic Covariance โ€ข is a scaled mixture of squared exponential covariance functions with different characteristic length-scales ( ๐‘š ). โ€ข As ๐›ฝ โ†’ โˆž the rational quadratic converges to the square exponential covariance. โ€ข Has sample functions that are infinitely differentiable for any value of ๐›ฝ 8

  9. Spherical Covariance 0 where โ„Ž = |๐‘ข ๐‘— โˆ’๐‘ข ๐‘˜ | otherwise 9 2 (โ„Ž โ‹… ๐‘š) 3 )) ๐ท๐‘๐‘ค(๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) = {๐œ 2 (1 โˆ’ 3 2 โ„Ž โ‹… ๐‘š + 1 if 0 < โ„Ž < 1/๐‘š Covariance โˆ’ sigma2=1 Spherical โˆ’ l=1 1.00 1 0.75 0 l=1 0.50 y l=3 โˆ’1 0.25 l=10 โˆ’2 โˆ’3 0.00 0.0 0.3 0.6 0.9 0.0 0.3 0.6 0.9 h x Spherical โˆ’ l=3 Spherical โˆ’ l=10 2 2 1 y y 0 0 โˆ’1 โˆ’2 โˆ’2 0.0 0.3 0.6 0.9 0.0 0.3 0.6 0.9 x x

  10. Periodic Covariance 10 ๐ท๐‘๐‘ค(๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) = ๐œ 2 exp (โˆ’2 ๐‘š 2 sin 2 (๐œŒโ„Ž ๐‘ž )) where โ„Ž = |๐‘ข ๐‘— โˆ’ ๐‘ข ๐‘˜ | Covariance โˆ’ l=2, sigma2=1 Periodic โˆ’ p=1 1.00 1 forcats::as_factor(Cov) 0.75 p=1 0 0.50 y p=2 0.25 p=3 โˆ’1 0.00 0 1 2 3 4 0 2 4 6 h x Periodic โˆ’ p=2 Periodic โˆ’ p=3 1 2 1 0 y y 0 โˆ’1 โˆ’1 โˆ’2 โˆ’2 0 2 4 6 0 2 4 6 x x

  11. Linear Covariance ๐ท๐‘๐‘ค(๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) = ๐œ 2 11 ๐‘ + ๐œ 2 ๐‘ค (๐‘ข ๐‘— โˆ’ ๐‘‘)(๐‘ข ๐‘˜ โˆ’ ๐‘‘) 1.0 0.5 0.0 y โˆ’0.5 โˆ’1.0 0.00 0.25 0.50 0.75 1.00 x

  12. Combining Covariances If we definite two valid covariance functions, ๐ท๐‘๐‘ค ๐‘ (๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) and ๐ท๐‘๐‘ค ๐‘ (๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) then the following are also valid covariance functions, ๐ท๐‘๐‘ค ๐‘ (๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) + ๐ท๐‘๐‘ค ๐‘ (๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) ๐ท๐‘๐‘ค ๐‘ (๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) ร— ๐ท๐‘๐‘ค ๐‘ (๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) 12

  13. Linear ร— Linear โ†’ Quadratic 13 ๐ท๐‘๐‘ค ๐‘ (๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) = 1 + 2 (๐‘ข ๐‘— ร— ๐‘ข ๐‘˜ ) ๐ท๐‘๐‘ค ๐‘ (๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) = 2 + 1 (๐‘ข ๐‘— ร— ๐‘ข ๐‘˜ ) Cov_a * Cov_b 5 0 y โˆ’5 โˆ’10 โˆ’2 โˆ’1 0 1 2 x

  14. 14 Linear ร— Periodic ๐ท๐‘๐‘ค ๐‘ (๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) = 1 + 1 (๐‘ข ๐‘— ร— ๐‘ข ๐‘˜ ) ๐ท๐‘๐‘ค ๐‘ (๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) = exp (โˆ’2 sin 2 (2๐œŒ โ„Ž)) Cov_a * Cov_b 2 0 y โˆ’2 โˆ’4 0 1 2 3 x

  15. Linear + Periodic 15 ๐ท๐‘๐‘ค ๐‘ (๐‘ง ๐‘ข ๐‘— , ๐‘ง ๐‘ข ๐‘˜ ) = 1 + 1 (๐‘ข ๐‘— ร— ๐‘ข ๐‘˜ ) ๐ท๐‘๐‘ค ๐‘ (โ„Ž = |๐‘ข ๐‘— โˆ’ ๐‘ข ๐‘˜ |) = exp (โˆ’2 sin 2 (2๐œŒ โ„Ž)) Cov_a + Cov_b 0 โˆ’1 draw โˆ’2 Draw 1 y Draw 2 โˆ’3 โˆ’4 โˆ’5 0 1 2 3 x

  16. Sq Exp ร— Periodic โ†’ Locally Periodic 16 ๐ท๐‘๐‘ค ๐‘ (โ„Ž = |๐‘ข ๐‘— โˆ’ ๐‘ข ๐‘˜ |) = exp (โˆ’(1/3)โ„Ž 2 ) ๐ท๐‘๐‘ค ๐‘ (โ„Ž = |๐‘ข ๐‘— โˆ’ ๐‘ข ๐‘˜ |) = exp (โˆ’2 sin 2 (๐œŒ โ„Ž)) Cov_a * Cov_b 2 1 0 y โˆ’1 โˆ’2 0 2 4 6 x

  17. Sq Exp (short) + Sq Exp (long) โˆš 3/2)โ„Ž 2 ) 17 3โ„Ž 2 ) โˆš ๐ท๐‘๐‘ค ๐‘ (โ„Ž = |๐‘ข ๐‘— โˆ’ ๐‘ข ๐‘˜ |) = (1/4) exp (โˆ’4 ๐ท๐‘๐‘ค ๐‘ (โ„Ž = |๐‘ข ๐‘— โˆ’ ๐‘ข ๐‘˜ |) = exp (โˆ’( Cov_a + Cov_b 1 0 y โˆ’1 โˆ’2 0.0 2.5 5.0 7.5 10.0 x

  18. Sq Exp (short) + Sq Exp (long) (Seen another way) 18 Cov_A (short) Cov_B (long) Cov_A + Cov_B 2 1 0 y โˆ’1 โˆ’2 โˆ’3 0.0 2.5 5.0 7.5 10.0 0.0 2.5 5.0 7.5 10.0 0.0 2.5 5.0 7.5 10.0 x

  19. BDA3 example 19

  20. BDA3 http://research.cs.aalto.fi/pml/software/gpstuff/demo_births.shtml 20

  21. Births (one year) 1. Smooth long term trend ( sq exp cov ) 2. Seven day periodic trend with decay ( periodic ร— sq exp cov ) 3. Constant mean 21

  22. Component Contributions We can view our GP in the following ways, but with appropriate conditioning we can also think of ๐ณ as being the sum of multipe independent GPs ๐ณ = ๐‚ + ๐‘ฅ 1 (๐ฎ) + ๐‘ฅ 2 (๐ฎ) + ๐‘ฅ 3 (๐ฎ) where ๐‘ฅ 1 (๐ฎ) โˆผ ๐’ช(0, ๐šป 1 ) ๐‘ฅ 2 (๐ฎ) โˆผ ๐’ช(0, ๐šป 2 ) ๐‘ฅ 3 (๐ฎ) โˆผ ๐’ช(0, ๐œ 2 ๐‰ ) 22 ๐ณ โˆผ ๐’ช(๐‚, ๐šป 1 + ๐šป 2 + ๐œ 2 ๐‰ )

  23. Decomposition of Covariance Components 0 โŽฃ ฮฃ 1 ฮฃ 2 ฮฃ 1 ฮฃ 1 0 ฮฃ 2 ฮฃ 2 โŽฆ โŽค โŽฅ โŽฆ โŽž โŽŸ โŽ  therefore ๐‘ข โŽก โŽข โŽฅ โŽœ โŽข โŽฃ ๐‘ง ๐‘ฅ 1 ๐‘ฅ 2 โŽค โŽฅ โŽฆ 23 โŽ โŽก โŽข โŽฃ ๐‚ 0 0 โŽค ฮฃ 1 + ฮฃ 2 + ๐œ 2 ๐‰ โˆผ ๐’ช โŽ› , โŽก ๐‘ฅ 1 | ๐ณ, ๐‚, ๐œพ โˆผ ๐’ช(๐‚ ๐‘‘๐‘๐‘œ๐‘’ , ๐šป ๐‘‘๐‘๐‘œ๐‘’ ) ๐‚ ๐‘‘๐‘๐‘œ๐‘’ = 0 + ฮฃ 1 (ฮฃ 1 + ฮฃ 2 + ๐œ 2 ๐ฝ) โˆ’1 (๐ณ โˆ’ ๐‚) ๐šป ๐‘‘๐‘๐‘œ๐‘’ = ฮฃ 1 โˆ’ ฮฃ 1 (ฮฃ 1 + ฮฃ 2 + ๐œ 2 ๐‰) โˆ’1 ฮฃ 1

  24. Births (multiple years) 1. slowly changing trend ( sq exp cov ) 2. small time scale correlating noise ( sq exp cov ) 3. 7 day periodical component capturing day of week effect ( periodic ร— sq exp cov ) 4. 365.25 day periodical component capturing day of year effect ( periodic ร— sq exp cov ) 5. component to take into account the special days and interaction with weekends ( linear cov ) 6. independent Gaussian noise ( nugget cov ) 7. constant mean 24

  25. Mauna Loa Exampel 25

  26. 26 Atmospheric CO 2 390 Source NOAA y 360 Scripps (co2 in R) 330 1960 1980 2000 x

  27. GP Model Based on Rasmussen 5.4.3 (we are using slightly different data and โˆ’๐›ฝ ) ๐›ฝ 27 ๐‘ง ฬ„ parameterization) ๐ณ โˆผ ๐’ช(๐‚, ๐šป 1 + ๐šป 2 + ๐šป 3 + ๐šป 4 + ๐œ 2 I ) {๐‚} ๐‘— = {๐šป 1 } ๐‘—๐‘˜ = ๐œ 2 1 exp (โˆ’(๐‘š 1 โ‹… ๐‘’ ๐‘—๐‘˜ ) 2 ) 2 exp (โˆ’(๐‘š 2 โ‹… ๐‘’ ๐‘—๐‘˜ ) 2 ) exp (โˆ’2 (๐‘š 3 ) 2 sin 2 (๐œŒ ๐‘’ ๐‘—๐‘˜ /๐‘ž)) {๐šป 2 } ๐‘—๐‘˜ = ๐œ 2 3 (1 + (๐‘š 4 โ‹… ๐‘’ ๐‘—๐‘˜ ) 2 {๐šป 3 } ๐‘—๐‘˜ = ๐œ 2 {๐šป 4 } ๐‘—๐‘˜ = ๐œ 2 4 exp (โˆ’(๐‘š 5 โ‹… ๐‘’ ๐‘—๐‘˜ ) 2 )

  28. JAGS Model } }โ€ alpha ~ dt(0, 2.5, 1) T(0,) } l[i] ~ dt(0, 2.5, 1) T(0,) sigma2[i] ~ dt(0, 2.5, 1) T(0,) for(i in 1:5){ } Sigma[i,i] <- sigma2[1] + sigma2[2] + sigma2[3] + sigma2[4] + sigma2[5] for (i in 1:length(y)) { } ml_model = โ€model{ Sigma[j,i] <- Sigma[i,j] Sigma[i,j] <- k1[i,j] + k2[i,j] + k3[i,j] + k4[i,j] k4[i,j] <- sigma2[4] * exp(- pow(l[5] * d[i,j],2)) k3[i,j] <- sigma2[3] * pow(1+pow(l[4] * d[i,j],2)/alpha, -alpha) k2[i,j] <- sigma2[2] * exp(- pow(l[2] * d[i,j],2) - 2 * pow(l[3] * sin(pi*d[i,j] / per), 2)) k1[i,j] <- sigma2[1] * exp(- pow(l[1] * d[i,j],2)) for (j in (i+1):length(y)) { for (i in 1:(length(y)-1)) { y ~ dmnorm(mu, inverse(Sigma)) 28

  29. Diagnostics 29 sigma2[1] sigma2[2] sigma2[3] sigma2[4] sigma2[5] 0.8 40 0.04 2.0 6000 0.6 30 1.5 4000 0.03 0.4 20 1.0 2000 0.2 10 0.5 0.02 0 0.0 0.0 0 l[1] l[2] l[3] l[4] l[5] 0.020 1.2 6 0.06 0.9 estimate 0.015 1.0 0.6 4 0.04 0.010 0.8 0.3 2 0.005 0.02 0.6 0.0 0 250500750 1000 0 250500750 1000 0 250500750 1000 0 250500750 1000 alpha 8 6 4 2 0 0 250500750 1000 .iteration

Recommend


More recommend