scikit-learn中的Python-Kriging(高斯过程)

2024-04-28 21:14:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在考虑用这个方法来插值一些我有的三维点。作为输入,我得到了一个地区不同海拔高度的气体的大气浓度。我得到的数据在几十英尺的垂直高度上每隔几英尺显示一个值,但是在水平方向上被几百英尺隔开(所以“列”的值都很紧凑)。

假设在任何给定的时间点,数值在垂直方向上的变化明显大于在水平方向上的变化。

我想在考虑了这个假设的情况下执行3D kriging(作为一个参数,我可以调整或统计定义-要么/要么)。

我相信scikit学习模块可以做到这一点。如果可以,我的问题是如何创建离散单元输出?也就是说,将数据输出到三维网格中,其尺寸为50 x 50 x 1英尺。理想情况下,我希望输出[x_location,y_location,value]并分离这些(或类似)距离。

不幸的是,我没有太多的时间来研究它,所以我只是希望在深入研究之前弄清楚在Python中这是否可能。谢谢!


Tags: 数据方法高度时间水平情况locationkriging
2条回答

在二维情况下,类似这样的操作应该可以:

import numpy as np
from sklearn.gaussian_process import GaussianProcess

x = np.arange(1,51)
y = np.arange(1,51)
X, Y = np.meshgrid(lons, lats)

points = zip(obs_x,  obs_y)
values = obs_data    # Replace with your observed data

gp = GaussianProcess(theta0=0.1, thetaL=.001, thetaU=1., nugget=0.001)
gp.fit(points, values)
XY_pairs = np.column_stack([X.flatten(), Y.flatten()])
predicted = gp.predict(XY_pairs).reshape(X.shape)

是的,你绝对可以在scikit_learn中完成。

实际上,可以使用各向异性协方差核是kriging/Gaussian过程回归的一个基本特征。

由于它在manual(下面引用)中被精确化,所以您可以自己设置协方差的参数,也可以估计它们。你可以选择所有参数都相等或者都不同。

theta0 : double array_like, optional An array with shape (n_features, ) or (1, ). The parameters in the autocorrelation model. If thetaL and thetaU are also specified, theta0 is considered as the starting point for the maximum likelihood estimation of the best set of parameters. Default assumes isotropic autocorrelation model with theta0 = 1e-1.

相关问题 更多 >