fatiando / verde

Processing and gridding spatial data, machine-learning style
https://www.fatiando.org/verde
BSD 3-Clause "New" or "Revised" License
601 stars 72 forks source link

Class to wrap a scikit-learn estimator in a Verde gridder #268

Open leouieda opened 4 years ago

leouieda commented 4 years ago

Description of the desired feature

The Verde gridders are basically linear models from scikit-learn with particular feature matrices (the Green's functions). But we might not want to use linear models and Green's functions for everything (for example #188 and #261). It would be helpful to have a class that wraps a given scikit-learn estimator in the Verde gridder API:

interp = vd.Gridder(estimator=SVC())
interp.fit(coordinates, data)
grid = interp.grid(...)

The assumption would be the feature matrix is a column stack of the given coordinates (each is a column in the matrix). This would allow passing in real coordinates (longitude, latitude) or other predictors (topography, ice_thickness, etc) as long as they all have the same size.

The bonus of this would be to give gridding powers to scikit-learn. So I think it's worth while.

Are you willing to help implement and maintain this feature? Yes but would welcome anyone to try it since I'm short on time

fmaussion commented 4 years ago

Thanks for these ideas! I'm not using verde yet so I can't really help, but I am happy to provide data for a real case example if needed

leouieda commented 4 years ago

@fmaussion that would be great! Do you have any data that is openly licensed (CC-BY or public domain)? That way we can include it as sample data in the project.

fmaussion commented 4 years ago

I think the easiest is to just generate a fake dataset.

Here is an example of a temperature field which is the combination of a purely linear elevation dependent field and some spatially correlated randomness: https://gist.github.com/fmaussion/3206241d17bacd1a299688d27915be57

Reconstructing this field would fail miserably if only the location of observations is taken into account, and work much better if the (linear) correlation with the known elevation is also considered.

What's the best format to send you these data? NetCDF + csv ok?