<jupyter_start><jupyter_text>Example 1: estimate a pollution model with a gaussian process<jupyter_code># create an environment to observe
env = PollutionModelEnvironment("water", 100, 100)
env.evolve_speed = 1
env.p_pollution = 0.1
for t in range(120):
    env.proceed()
plt.imshow(env.value, vmin=0, vmax=1.0)
# create an observation model
#im = ScalarFieldInformationModel_stored_observation("sample", env.width, env.height, \
#                                                    estimation_type="disk-fixed", 
#                                                    estimation_radius=10)
im = ScalarFieldInformationModel_stored_observation("sample", env.width, env.height, \
                                                    estimation_type="gaussian-process"
                                                    )
# generate a series random observations
for i in range(20):
    x = random.randint(0, env.width-1)
    y = random.randint(0, env.height-1)
    value = env.value[x,y]
    obs = {"x": x, "y": y, "value": value}
    im.add_observation(obs)
im.proceed(1)
#plt.imshow(im.value, vmin=0, vmax=1.0)
plt.imshow(im.uncertainty, vmin=0, vmax=1.0)
plt.imshow(im.uncertainty, vmin=0, vmax=1.0)
kernel = RationalQuadratic(length_scale = [2.0, 2.0], length_scale_bounds = [1, 100], \
                           alpha=0.1) +\
    WhiteKernel(noise_level=0.2)
#kernel = RationalQuadratic(length_scale = [2.0, 2.0], length_scale_bounds = [1, 100], alpha=1000) +\
#    WhiteKernel(noise_level=0.2)

#kernel = RBF(length_scale = [2.0, 2.0], length_scale_bounds = [1, 100]) +\
#    WhiteKernel(noise_level=0.5)

im2 = ScalarFieldInformationModel_stored_observation("sample", env.width, env.height, \
                                                    estimation_type="gaussian-process",
                                                     gp_kernel = kernel
                                                    )
im2.observations.extend(im.observations)
im2.proceed(1.0)
plt.imshow(im2.value, vmin=0, vmax=1.0)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup