How to Interpolate Data with Scipy

One- or multi-dimensional data interpolation made easy with Python Scipy package.

Tirthajyoti Sarkar
Productive Data Science

--

Image source: Created by the Author

What are we trying to achieve?

Interpolation may sound like a fancy mathematical exercise, but in many ways, it is much like what machine learning does.

  • Start with a limited set of data points relating multiple variables
  • Interpolate (basically, create a model)
  • Construct a new function that can be used to predict any future or new point from the interpolation

So, the idea is — ingest, interpolate, predict.

Concretely, suppose we have a limited number of data points for a pair of variables (x,y) that have an unknown (and nonlinear) relationship between them i.e. y = f(x). From this limited data, we want to construct a prediction function that can generate y values for any given x values (within the same range that was used for the interpolation).

Image source: Created by the Author

There are a lot of mathematical theories and work on this subject. You can certainly write your own algorithm to implement those interpolation…

--

--

Tirthajyoti Sarkar
Productive Data Science

Sr. Director of AI/ML platform | Stories on Artificial Intelligence, Data Science, and ML | Speaker, Open-source contributor, Author of multiple DS books