Spline regression demo

Link to notebook here

There are many modeling tasks in computational chemistry that can be addressed with a smooth function that varies by distance (e.g. additive forcefields used in molecular dynamics and conformer generation). These functions are usually a balance between accuracy with respect to the underlying physical process on the one hand, and being fast to calculate on the other. One solution I don't see a lot is splines, but these seem like ideal functions for compchem, being smooth and adjustable to many situations without requiring any specification of a functional form.

Today's notebook demonstrates how to use b-splines to fit simple smooth curves in 1D and 2D. While it's not an in-depth or rigorous mathematical description of the workings of b-splines, having some hands-on code to play with, and plot, helped me to build intuition around how one might use splines in an ML setting. And that intuition is mainly this: the complexity in implementing B-splines can be abstracted away into scipy.interpolate's BSpline method. That method outputs an embedding of your input features, transforming them into a new coordinate system which is favourable for smooth regression. With some basic intuition and example code to hack on, I now feel ready for a more rigorous and mathy dive into the topic, as in this quite excellent blog post here.