1

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!

Mannaggia
  • 4,559
  • 12
  • 34
  • 47
  • Did you mean *n*-dimensional space? – Warren Weckesser Aug 11 '15 at 14:33
  • 1
    I would keep looking at http://docs.scipy.org/doc/scipy/reference/ndimage.html#module-scipy.ndimage.filters, there are smoothing filters for n-d operations. – jhamman Aug 11 '15 at 15:15
  • @WarrenWeckesser: yes – Mannaggia Aug 11 '15 at 17:14
  • @sea_hydro: here are some interesting filters, but I do not know how to use them given my representation of the data, I do not have a grid of function values which I can just provide as input. I guess I need a sort of meshgrid? – Mannaggia Aug 11 '15 at 20:13

1 Answers1

1

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

HYRY
  • 94,853
  • 25
  • 187
  • 187