bgrimstad / splinter

Library for multivariate function approximation with splines (B-spline, P-spline, and more) with interfaces to C++, C, Python and MATLAB
Mozilla Public License 2.0
414 stars 115 forks source link

Greater than bivariate B-splines #119

Closed BKillen05 closed 2 years ago

BKillen05 commented 5 years ago

I have just started using / investigating this project and it looks like exactly what I am looking for. I am using the python interface and intend to fit cubic B-splines to n number of independent variable data, the number of variables can be anywhere from 1 up to a possible 6, i.e., 6 input values to a single output.

I have been able to run all the examples for bivariate splines and have been able to implement the splines for both one and two variables but when I try 3 or more I get an error (attached). I have looked through the other examples but cannot find any examples for anything greater than bivariate.

Capture

Is it possible to use Splinter for this number of input variables ? Apologies in advance if this is not the appropriate place to post such a question.

Thank you in advance for any clarification or information you can provide.

bgrimstad commented 5 years ago

Hello,

Apologies for the late response.

There should not be any limitations on the number of variables or degrees, but we advise that you stay below 5-6 variables (this limitation is due to the construction of tensor-product splines, rather than SPLINTER). Also, for most applications it is sufficient to use cubic splines.

I am not familiar with that error message, but I see that you are running an older SPLINTER version on Windows. I suspect that this may be causing you trouble.

If you have the opportunity, you could try to solve your problem on a Linux machine. You can use pip to install the latest splinter version. It currently resides in the develop branch, where you will find some instructions.

Hope this helps!

BKillen05 commented 5 years ago

Hello,

Thank you for your response.

For my problem I should have a maximum of 4 variables which I want to the cubic spline function fitting for.

Unfortunately, the problem I want working on is part of a backend for a Windows Application so moving to or trying on a Linux machine isn't an option.

Is there anyway which I can install the most up to date version on my Windows machine or it is likely the version I am using is the most up to date Windows version ?

Thank you

bgrimstad commented 5 years ago

Hi,

We have not made a release of version 4 yet - it is the version you will find in the develop branch. So you basically have two options:

  1. You try to compile it yourself, for example using MinGW
  2. You wait for us to do it (expected delivery some time between 1 month - infinity)

If you go with option 1), you may seek some advice from @gablank. It should be possible to get the latest version running on Windows relatively quickly.

I had to go back and check the Python API of the version you are using (v3) and I see that we did, at that point, hardcode a limit on the degree. The limit was 0 <= degree <= 5.

For development purposes you may try to solve your problem on a virtual Linux machine. It may be a good idea to check that SPLINTER actually solves your problem satisfactory before you attempt to compile for Windows.

BKillen05 commented 5 years ago

Thank you for all your suggestion. I cleaned up some of the input for my code and the way which I constructed the input matrix. It seems that may have been causing my problem. Using version 3 in python 2.7 solved my problem perfectly. Thanks again for the help and making the toolbox freely available.

Best