-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX problem with extra dimension that makes linear interpolation failing #247
Conversation
Do you have a minimal working example of the problem? Not sure if a change in the pod module because of a problem with the linear interpolation module is the best fix. |
I also think it's not the best fix. I have an example reproducing the problem. I pushed it here: tutorials/tutorial-2.py |
@giovastabile is the problem still there if you use |
yes because the problem is not in the shape of the parameters but in the shape of the pod modes. The error occurs while doing: `File ~/.local/lib/python3.10/site-packages/ezyrb/pod.py:124, in POD.inverse_transform(self, X) ValueError: shapes (1639,500) and (500,1,1) not aligned: 500 (dim 1) != 1 (dim 1)` |
X should not be 500,1,1 but 500,1 I didn't investigate why this happens only with Linear interpolation |
@giovastabile are you using squeeze? |
Yes, I assume the fix should be in the Linear class. The predict call does not work in case you use a linear interpolation. with RBF everything is fine |
This minimal example works on my machine with the current ezyrb version (even using
the output is
to replicate your error I have to pass |
update not working file Fix in Linear class
8c7d586
to
063013c
Compare
This minimal example does not work in my case:
With the latest fix I did, it works fine |
I'm not 100% sure I got the problem: have you tried to run the tests on your machine? The example you provided looks already checked in this test Line 44 in e57fe51
EDIT: you're right, the example fails also on my machine, but I still have to figured out the reason. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were checking the linear interpolation only for 1D input with 1D output, or ND input with ND output. Your case (1D-ND) was never tested before!
Now everything works, I also added a small test to check this behavior in future. Thanks @giovastabile!
You could also do a linear interpolation (or a higher order interpolation) using the RegularGrid interpolator:
|
…ing (mathLab#247) * FIX problem with extra dimension that makes linear interpolation failing
Not sure it this is the best fix. In case one is using linear interpolation there is one extra dimension that makes the linear interpolation failing (e.g. one can try tutorial 2 with Linear interpolation). This fix solves the problem