Open osu1191 opened 2 years ago
Hi Paul,
You could try to increase the maximum number of levels in the MBA hierarchy (max_levels
) in order to improve interpolation precision. There is also the tol
parameter that controls the stopping criteria:
https://github.com/ddemidov/mba/blob/master/mba/mba.hpp#L728
If you know the shape of the background trend, you could provide it to the constructor as initial
function:
https://github.com/ddemidov/mba/blob/master/mba/mba.hpp#L729
Each new level in the MBA hierarchy tries to approximate the delta between the target points and the results of the previous levels. When you provide a decent initial approximation, MBA has less work to do.
On the other hand, if smootheness is more important than precision, you could try decreasing the max_levels
parameter.
Thanks for your suggestion. I had been using pilot version of your code so far, and it ran pretty well without any installation, using the C-code provided in readme. Could you tell me, what's required for the compilation process, for the changes you suggested me to make. I saw a setup.py file in the home directory, and tried running using python/3.6. It tried to make changes to one of the python packages in a read-only directory of the supercomputer I am working on.
_python setup.py install running install error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the installation directory:
[Errno 30] Read-only file system: '/usr/local/anaconda5/lib/python3.6/site-packages/test-easy-install-4149.write-test'_
I see the code is written in C, and header files also have no calls to any python libraries. I understand all of the python related part is in the pybind11. Are you using/calling any python functions? If yes, could you tell me the compilation process of this routine?
Thanks in advance, Paul
If you work in C++, you don't need to compile the python wrapper. The MBA class constructor has some optional arguments with default values, you just need to specify those:
// Algorithm setup.
mba::MBA<2> interp(lo, hi, grid, coo, val, /*max_levels=*/ 5, /*tol=*/ 1e-3, /*min_fill=*/0.5, /*initial=*/[](double a){ return 0;});
Hello Mr. Demidov,
I have opened a new issue as per your suggestion.
As mentioned in my previous request, I am trying to do smooth interpolation of a function from a 3-D scattered dataset (10^4 points) to a 3-D regular set of grid points (10^6 points). (1) The top-left figure is my scattered dataset, and as you can see there is no anisotropy in the dataset. (2) The top-right is the target-values I am trying to achieve, i.e. when you compute the actual function on each regular grid points. (3) The bottom figure is the difference plot between the values interpolated from the scattered grid (m= [3, 3, 3]) and target values on the regular grid.
As you can see, in spite of the smoothening, I have some discontinuities/inaccuracies in the dense region as well as sparse region. Is there a way to optimize or avoid this? I have seen your link in my previous answer, and I would like to know what parameters other than "grid=[m, m, m]" can I play with in this implementation. The reason I need a smooth interpolation is because, I will have to apply double derivative operator upon the interpolated function to arrive to my actual result. So, even though the differences seem small, it will get ramified in my final answer.
Thanks in advance, Paul