Fitt Curve in a set of Points (PointCloud)

Hello
My goal is to adjust a polyline in a selection of points to draw a tube. I tried it with the tool from LunchBox with Machine Learning. But I cannot achieve that the curve runs cleanly within the points.
Does anyone have a good idea how to do that? In the end I want to be able to apply it to 3D points.

Thanks for the help

An example file is attached
Example_LinearRegression.gh (17.3 KB)