[ 
https://issues.apache.org/jira/browse/MATH-1534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17116308#comment-17116308
 ] 

Gilles Sadowski commented on MATH-1534:
---------------------------------------

bq. [...] my own "guessing" [...]

Would you provide a PR/patch (with unit tests) so that we can compare?

bq. [...] use PolynomialCurveFitter [...]

At first sight, that seems "heavy-weight" since the fitter calls a non-linear 
least-squares optimizer.  The idea of the "guesser" is that it should be fast.  
Then again, I don't think we ever made any benchmark...

> 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)

Reply via email to