Christoph Läubrich created MATH-1534:
----------------------------------------

             Summary: GaussianCurveFitter.ParameterGuesser uses supicious 
halfHeight calculations
                 Key: MATH-1534
                 URL: https://issues.apache.org/jira/browse/MATH-1534
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 3.6.1, 4.0
            Reporter: Christoph Läubrich


I'm currently looking into some curve-fitting and have examined the

basicGuess(WeightedObservedPoint[])

in GaussianCurveFitter.ParameterGuesser, and there is one thing I don't really 
understand.

in [Line 
301|https://github.com/apache/commons-math/blob/master/src/main/java/org/apache/commons/math4/fitting/GaussianCurveFitter.java#L301
 ] the "halfY" is computed by n (what is the maximal y value of the 
observation) + half the sum of n+m (where m is the x value of the maximum) 
applying this to some of my datapoints that fit relatively good as a Gaussian 
later, it seems that this condition never works (assuming that max X != 0), and 
the default in the catch clause is used instead. It seems that the optimizer is 
quite well in fitting the data anyways.

[~erans] also suggested on the mailinglist that:
{quote}it seems that the current code could be made more robust by
shifting the abscissa of the maximum height to 0 before performing
the rest of the computation{quote}

For my own "guessing" I used the following strategy, I'm not sure if the 
current code does something similar:
# Use p[0] and p[max] to form a line, then use PolynomialCurveFitter to  fit 
the line to all points on the left
# Use the fitted line to calculate Xleft at Ymax
# do the same for the rigtht portion
#  Assume fwhm = rightX-leftX



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to