Skip to content
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

FFX not summing expressions of same variable with different coefficients #49

Open
misgeatgit opened this issue Apr 20, 2020 · 3 comments

Comments

@misgeatgit
Copy link

I just came across the following FFX model:

(-0.124 - 0.228*Land_Use - 0.228*Land_Use) / (1.0 + 2.62*Land_Use + 2.60*Land_Use)   

Why isn't FFX reducing this expression?

@misgeatgit misgeatgit changed the title FFX not summing expression of same variable with different coefficients FFX not summing expressions of same variable with different coefficients Apr 20, 2020
@jmmcd
Copy link
Collaborator

jmmcd commented Apr 21, 2020

I think I've seen this before but didn't really investigate. Would you be able to show us a small dataset/code that gives this result?

@misgeatgit
Copy link
Author

@jmmcd thanks for replying. Here is the code to reproduce this:
https://gist.github.com/misgeatgit/dae5ce08a101f10c3e4a861ec99fb904
and input data is here https://github.com/misgeatgit/prj-climate/tree/master/data/ffx

@jmmcd
Copy link
Collaborator

jmmcd commented Apr 21, 2020

Thanks. Yes, when building that model I see that we get duplicate bases.

After Step 1A we have four (non-duplicate) Order-1 bases: x0, x1, x2, x3.

But just before we return from build, we have the following bases:

here are the order1 bases
x1
x2
x1
x2
x3
here are the order2 bases
x1^2
x2^2
x1^2
x2^2
x3^2
x2 * x1
x1 * x2

That contains several duplicates and even a "mirror image" (cf model_factories.py L 331).

I'll look more later...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants