Comments (1)
Hi, @dential.
I am currently on parental leave and have not had the opportunity to answer you earlier.
First, thank you for a presenting your question in such a clear way.
The behavior you are observing is related to how the regression problem is solved. Let me try to explain it briefly without oversimplifying. When you call the .bspline_interpolator or .fit method, a linear system of equations is solved for the coefficients of the B-spline. The number of variables is equal to the number of coefficients of the B-spline, which is determined by the knot sequence. The number of equations is equal to the number of data points.
Say you have N data points that you wish to interpolate with a B-spline of degree 3. The .bpline_interpolator method will design a knot sequence which gives N coefficients. For this case it will repeat end knots 4 times and remove two internal knots as you pointed out. With N data points (equations) and N coefficients (variables), the linear system becomes square and a unique solution can be found (under some technical assumptions on linear independence).
If you manipulate the knot sequence, for example by adding knots, the linear system can become underdetermined. This means that there are more variables than equations and there is no longer a unique solution. The added variables increase the flexibility of the spline. As in your example with an augmented knot sequence, the spline can interpolate all points and begin to oscillate. To avoid this you may either reduce the number of knots to give you N coefficients, or put a penalty on the coefficients to encourage them to be close to zero (this technique is called regularization).
If you wish to introduce a discontinuity at a point you have to increase the knot multiplicity, as you already have understood. Combine this with one of the two approaches above to avoid oscillations.
If you use the .from_param and .fit method, you have to specify the knot sequence yourself. Designing a good knot sequence can be difficult and may require some knowledge of the data you have. With .bspline_interpolator, Splinter tries to automatically construct a good knot sequence, but it may be suboptimal for some problems.
Hope that helps! And thank you for using the library.
Kind regards,
Bjarne
from splinter.
Related Issues (20)
- Greater than bivariate B-splines HOT 4
- Faster bspline evaluation using vectors? HOT 3
- One bug in PSPLINE HOT 1
- What is the structure of the PyPI splinter package? HOT 1
- Number of spans in U and V direction in resulting surface HOT 1
- How to obtain libsplinter-4-0.dll in Win10 ? HOT 1
- P-Spline: determine the "best" smoothing parameter HOT 2
- Potential memory leak HOT 4
- Using library in c# code HOT 2
- How to plot the b_spline curve in x-y plane? HOT 1
- not-a-knot end conditions
- Protected constructor BSpline() results in error C2248 - cannot access protected member HOT 8
- Penalized B-spline dies while building HOT 7
- Very slow build of the bspline object HOT 20
- Automatic smoothing parameter selection HOT 3
- Run C++ sample code all night and can not return back result HOT 1
- In python spline.eval_jacobian(p) returns only the first column of the jacobian HOT 2
- Comparisons to some other standard spline packages? HOT 1
- C++ interface example outputs "double free or corruption (out)"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from splinter.