[
https://issues.apache.org/jira/browse/MATH-1534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17116451#comment-17116451
]
Christoph Läubrich commented on MATH-1534:
------------------------------------------
I'll try to provide a patch, a SimpleRegression could be enough here I just has
used this for a first simple try to play around a little bit with different
techniques. It was really fast anyways as I only compute around 1000 fits but
I'll try to recheck with SimpleRegression. I also used Polynomial because I
don't find any dedicated "Line" in common-math but maybe there is already a
class for this purpose?
Maybe it would also be an option to have multiple "guesser" classes?
> 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: 4.0, 3.6.1
> Reporter: Christoph Läubrich
> Priority: Minor
>
> 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)