这种平滑的名称是什么?

机器算法验证 r 平滑
2022-04-07 08:10:34

本质上,下面的代码产生类似于运行平均值的东西,但不是窗口上的 0/1 权重,而是考虑到以 x 位置为中心的高斯权重。

我很确定这个过程(或类似的东西)必须有一些名字,但我认为我缺乏适当的术语来谷歌查找更多信息。例如,如果我输入“高斯平滑”,我会得到很多图像处理命中,这似乎与此相邻,但也不完全是此。因此我的问题是,以下叫什么?

x <- iris$Petal.Length
y <- iris$Sepal.Length

xseq <- seq(min(x), max(x), length.out = 100)

# For every point in x, calculate the distance to xseq
# Then, give gaussian density for that distance
weights <- dnorm(outer(x, xseq, "-"), sd = 0.5)
# Normalise by total weight per point in xseq
weights <- t(t(weights) / colSums(weights))

# For every point in xseq, calculate sum of weights of y
new_y <- colSums(weights * y)

# Illustrate points and smoothing
plot(x, y)
lines(xseq, new_y, col = 2)

reprex 包于 2021-10-26 创建(v2.0.1)

1个回答

这种技术称为内核回归:https ://en.wikipedia.org/wiki/Kernel_regression 。我相信您的变体是带有高斯内核的 Nadaraya–Watson 内核回归。