I want to adjust with a Gaussian Process the relative humidity (RH) with height of only 6 points (stations). My goal is, after that, find the probable altitude of the line of 50% RH.
So, if one day at some hour I have (X is for RH, y for altitude):
X = np.array([32, 38, 94, 83, 99, 78]) y = np.array([1702, 1514, 683, 269, 900, 86])
with pm.Model() as d_model: # Specify the covariance function vert = pm.Exponential("vert", 0.5) l = pm.Gamma(name='l', alpha=7, beta=1) cov_func = vert**2 * pm.gp.cov.Matern32(1, ls=l) # Specify mean mean_init = pm.gp.mean.Constant(c=500) # Specify the GP gp = pm.gp.Marginal(mean_init, cov_func=cov_func) # Place a GP prior over the function and do the noise: sigma = pm.HalfCauchy("sigma", beta=1) y_ = gp.marginal_likelihood("y_", X=X, y=y, noise=sigma) # MCMC: trace = pm.sample(10000, chains=3, tune=1000, target_accept=0.85)
Now, if I want to make a prediction for RH=50, among others:
with d_model: X_new = np.array([12, 50, 78])[:, None] f_p = gp.conditional("f_p", X_new) pred_samples = pm.sample_posterior_predictive(trace, var_names=["f_p"], samples=10)
In the plot (code omitted for brevity) I get a very poor adjustment. I have tried changing some parameters and changing some stuff but the adjustment does not go well.
Is it just a problem of few data and Gaussian Process should not be used here or is there some part regarding the definition of the Gaussian Process I don’t get? Thx.