Skip to content

[FIX] Negative sigma when fitting asymm. EGH through optimization - #3195

Merged
timosachsenberg merged 1 commit into
OpenMS:developfrom
jpfeuffer:fix/FFCasymmetric
Jan 23, 2018
Merged

timosachsenberg merged 1 commit into
OpenMS:developfrom
jpfeuffer:fix/FFCasymmetric

Conversation

@jpfeuffer

Copy link
Copy Markdown
Contributor

Related to #3193

@timosachsenberg
timosachsenberg merged commit 1135f65 into OpenMS:develop Jan 23, 2018
double abs_tau = fabs(tau_);
double phi = atan(abs_tau / sigma_);
double abs_sigma = fabs(sigma_);
double phi = atan(abs_tau / abs_sigma);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can sigma ever by negative? This is supposed to be the square root of the variance ... if this is negative, then the fit failed, right? I think simply setting it to the absolute value is a hack but leads to very wrong results ... should it not just be zero then?

Also, do we have an example of such a degenerate case? maybe we can add it to the tests?

@hroest

hroest commented Jan 23, 2018

Copy link
Copy Markdown
Contributor

@timosachsenberg @jpfeuffer that looks like a short term fix but I think that its a pretty bad choice in terms of the area and the other parameters that will be derived from this. I think if it fails to fit we should set sigma either to zero or throw an exception

@jpfeuffer

jpfeuffer commented Jan 23, 2018 •

Copy link
Copy Markdown
Contributor Author

Yes I have an example here. I can add it. I agree that it looks weird but I don't think that it's necessarily wrong to use the absolute value here. I think the negative values only arise if they were fitted through the LM procedure which tries to fit Sigma (not Sigma square) and can result in local optima with a negative value. Not an expert here though. I can check if the fits still make sense.
You can see in the rest of the code that the abs was already taken at some points. In the others problems just didn't appear because the square of Sigma is used.

@hroest

hroest commented Jan 23, 2018

Copy link
Copy Markdown
Contributor

I think the negative values only arise if they were fitted through the LM procedure which tries to fit Sigma and can result in local optima with a negative value

I agree but I dont quite see how the absolute value is any more correct than using zero -- unless what you are really fitting is sigma_squared ? Still, if possible lets add the example. Does the area seem sensible when you look at the example - I am just a bit worried that the area calculation does not make any sense any more once you have negative values from the fit.

@jpfeuffer
jpfeuffer deleted the fix/FFCasymmetric branch October 7, 2019 09:54
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.

3 participants