高斯过程的预测标准偏差值仅在[0,1]

我正在使用scikit-learn的高斯过程来估计黑盒似然函数f(.)的行为。

我不知道此函数f(.)产生的值的范围,但凭经验我知道它可能低至-Yxxxx(其中Y可以是除0以外的任何整数)到0的范围。 。由于我不知道该黑盒函数可以产生的值的范围(甚至可能小于-99999),因此无法规范f (.)的输出值。

我正在使用scikit-learn's Gaussian Process module来拟合基础的黑盒函数,然后使用gp.predict function来获取一些未观察到的点的均值和标准偏差的估计值。

但是,我注意到所有预测的标准偏差值都在(0,1)范围内,而不是更有意义的值(例如500、1000等),我可以很容易地用给定的预测值来解释这些值。因此,在绘制图时我无法使用这些std值,因为预测的均值在(-15000,0)等正常范围内,而GP预测的相应标准偏差值在(0,1)范围内,因此曲线图显示了一条曲线,在预测均值附近没有任何不确定性。看来gp.predict并没有采用导致我期望的标准偏差输出值的输入参数,而且看起来像高斯过程回归软件包期望输入也要进行归一化。

所以我想知道scikit中是否有一种方法可以使gp.predict输出标准偏差值在正确的范围内?

我还在考虑,如果我简单地将预测标准偏差值与其相应的预测平均值相乘,以获得与该平均值相对应的实际标准偏差值的估计,那是否可以。例如,如果预测的平均值是-4000且预测的std是0.3,则我将做abs(-4000 x 0.3)并获得1200作为标准偏差。是否想知道这样做在统计上是否有效?

这是我为此编写的一些代码:

from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import Matern
import numpy as np

np.random.seed(1)
maternParams = {'length_scale': 1.0,'nu': 1.5}
gp = GaussianProcessRegressor(alpha=1e-6,kernel=Matern(**maternParams),n_restarts_optimizer=55,random_state=1,normalize_y=True)

def samplePointToExplore(num):
    return np.random.uniform(0,1,[num,1])

def blackBox(x):
    return x*-50000 # in reality I don't know the range of the values that the black box function outputs. All I know is the maximum value is 0

def fit():
    x = samplePointToExplore(num=10)
    y = blackBox(x)
    gp.fit(x,y)

def predict():
    unobservedX = samplePointToExplore(num=30)
    mean,std = gp.predict(unobservedX,return_std=True)
    print ('predicted means\n',mean)
    print ('\n')
    print ('predicted stds\n',std) # it doesn't make sense to have predicted means much further than 0 but stds always between [0,1]

fit()
predict()

这是代码的输出:

predicted means
 [[-20957.66988296]
 [-35331.92990453]
 [-10238.78971719]
 [-26636.61833481]
 [  -838.72663009]
 [-34675.39966961]
 [-20865.00317845]
 [-28056.71144867]
 [ -7032.54973937]
 [ -9915.78445386]
 [-32067.40236195]
 [-21829.40973117]
 [-15669.22655431]
 [-35587.02523481]
 [-26748.50523455]
 [-25604.08374355]
 [ -4192.53254258]
 [ -1425.51944213]
 [ -8480.24312985]
 [-26635.00045856]
 [ -4950.76519281]
 [-21051.04953399]
 [-22277.84765094]
 [-26630.26308104]
 [-35572.41068601]
 [-15773.72181341]
 [-35381.28600248]
 [-29624.16144327]
 [  -460.82365998]
 [-35186.333605  ]]


predicted stds
 [0.00981394 0.25745652 0.09720506 0.82856502 0.14644526 0.32783516
 0.00159755 0.14603516 0.02986324 0.06477662 0.56413143 0.94856942
 0.0467216  0.21547417 0.82475983 0.86127977 0.04196844 0.16843207
 0.05290022 0.82861966 0.03190417 0.01879954 0.94060514 0.04248253
 0.21826107 0.0518544  0.25027037 0.70650005 0.11227394 0.24908349]

您会看到预测的标准偏差值都在[0,1]之间,这不是应该的,因为现在我无法使用这些值来生成有意义的图,该图显示了预测均值周围的不确定性。

abk168 回答:高斯过程的预测标准偏差值仅在[0,1]

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3113253.html

大家都在问