python - Machine Learning 2D Regression with confidence bands
I have measures of a variable versus time.
I want to obtain a regression with confidence bands so that the plot sounds like this:


Given an arbitrary x, I "predicted" the y and its confidence by evaluating mean and std of N closest measured points. But I feel like this is quite naive.

I was wondering if it is possible to obtain a similar result with Machine Learning, Neural Network, ...

I'm quite familiar with python, sklearn and pytorch so if you please could suggest a solution that implements those tools I would be very thankfull.

You can achieve something like that with Gaussian Processes. For regression problems, you can use GaussianProcessRegressor from sklearn.

This is an example of how to use it to obtain the plot you are looking for.
