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

Changing how Lambdas are normalized if Simplex=True #2

Open
wants to merge 1 commit into
base: devl
Choose a base branch
from

Conversation

facero
Copy link
Collaborator

@facero facero commented Apr 28, 2022

When testing the IAE and the BSP on X-ray spectra, the BSP was giving strange spectra in ~5-10% of the cases.
Investigation revealed that this was due to the simplex constraint not being followed (Sum(Lambdas)>1) hence producing strange spectra as an output.

This PR modifies two things:

  • Lambdas need to be divided by sum(L) not sum(abs(L))
  • new Lambdas were not updated in params["Lambda"]

When testing Sum(L) is now 1 for the cases I tested and BSP and FastInterp now provide consistent results.

Two issues here:
- Lambdas need to be divided by sum(L) not sum(abs(L))
- new Lambdas were not updated in params["Lambda"]
When testing Sum(L) is 1 now (not the case before).
@facero
Copy link
Collaborator Author

facero commented Apr 28, 2022

Note that in the interpolator the absolute value is not present which would explain why FI was working and not BSP

Lambda = Lambda / (np.sum(Lambda, axis=1)[:, np.newaxis] + 1e-3) # not really a projection on the simplex

However a similar issue could exist here in the sparse_code interpolator where the absolute value is present. Maybe its worth fixing it as well.

Lambda = Lambda / (np.sum(np.abs(Lambda), axis=1)[:, np.newaxis] + 1e-3) # not really a projection on the simplex

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

Successfully merging this pull request may close these issues.

1 participant