Piecewise curve fitting

Job ID: 34847429

Budget: $10 – $30 CAD

This is a simple task of finding a piecewise linear function that best fits a set of observations. In other words, given a set of points, write a simple python function that will estimate the nodes. Points and nodes are shown in gray and red in the attached image (sample_30.png).

The chosen algorithm should have acceptable accuracy where all the nodes fall within the bounds of the points; and take no more than 80ms to execute. You are free to use any speed optimizations such as numpy vectorization, numba, etc.

Sample data and starter code is provided. pts_X.csv contains points and nodes_X contains nodes.
Related categories: Python Statistics Mathematics NumPy Computer Vision