搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  Gaussian_Processes_for_Machine_Learning.pdf
资料下载链接地址: https://bbs.pinggu.org/a-2409474.html
附件大小:
在网上看到的,和大家分享,共同学习:
#
#
#
#
#
#
模拟用的函数:
  1. # 需要已经安装了MASS包
  2. gaussprocess <- function(from = 0,
  3. to = 1,
  4. K = function(s, t) {min(s, t)},
  5. start = NULL,
  6. m = 1000) {
  7. # Simulates a Gaussian process with a given kernel
  8. #
  9. # args:
  10. # from: numeric for the starting location of the sequence
  11. # to: numeric for the ending location of the sequence
  12. # K: a function that corresponds to the kernel (covariance function) of
  13. # the process; must give numeric outputs, and if this won't produce a
  14. # positive semi-definite matrix, it could fail; default is a Wiener
  15. # process
  16. # start: numeric for the starting position of the process; if NULL, could
  17. # be randomly generated with the rest
  18. # m: positive integer for the number of points in the process to simulate
  19. #
  20. # return:
  21. # A data.frame with variables "t" for the time index and "xt" for the value
  22. # of the process

  23. t <- seq(from = from, to = to, length.out = m)
  24. Sigma <- sapply(t, function(s1) {
  25. sapply(t, function(s2) {
  26. K(s1, s2)
  27. })
  28. })

  29. path <- MASS::mvrnorm(mu = rep(0, times = m), Sigma = Sigma)
  30. if (!is.null(start)) {
  31. path <- path - path[1] + start# Must always start at "start"
  32. }

  33. return(data.frame("t" = t, "xt" = path))
  34. }
复制代码

模拟“维纳过程”:
  1. library(tidyverse)
  2. gaussprocess() %>%
  3. ggplot(aes(t, xt)) +
  4. geom+line() +
  5. theme_bw()
复制代码


模拟“高斯过程”:
  1. gaussprocess(K = function(s, t) {exp(-16 * (s - t) ^ 2)}) %>%
  2. ggplot(aes(t, xt)) +
  3. geom_line() +
  4. theme_bw()
复制代码



有兴趣的同学可以看看相关书籍:


    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2026-2-3 07:24