Reputation: 4829
I have function defined in an n-dimensional space which I represent with (X,Y), where X is an array of size mxn containing the input features and Y an array of size mx1 containing the output. So there are m points in an d-dimensional space with m >> n.
I would like to smooth the values of Y (output). In the case of 1 or 2 dimensions I would probably use smoothed splines. In the case of n dimensions I do not really know... I thought about the median filter in scipy (median_filter), but it is not clear to me how to find neighbours in X and fetch the corresponding values in Y to compute the median.
Any ideas? Thanks!
Upvotes: 1
Views: 714
Reputation: 97331
You can use scipy.spatial.KDTree
to find points in some radius and then find the median value of Y.
Or maybe use some regression method in sklearn, such as Support Vector Regression
Upvotes: 1