Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E350AC148 for ; Wed, 13 Jun 2012 15:51:47 +0000 (UTC) Received: (qmail 93249 invoked by uid 500); 13 Jun 2012 15:51:46 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 93144 invoked by uid 500); 13 Jun 2012 15:51:46 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 93127 invoked by uid 99); 13 Jun 2012 15:51:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jun 2012 15:51:46 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FSL_RCVD_USER,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [140.174.105.244] (HELO panasys.com) (140.174.105.244) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jun 2012 15:51:37 +0000 Received: (qmail 68882 invoked by uid 27124); 13 Jun 2012 15:51:15 -0000 Received: from unknown (HELO [127.0.0.1]) (kumar@[67.170.223.8]) (envelope-sender ) by 140.174.105.244 (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 13 Jun 2012 15:51:15 -0000 Message-ID: <4FD8B6EE.5040407@panasys.com> Date: Wed, 13 Jun 2012 08:51:10 -0700 From: "B.Kumar" User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:13.0) Gecko/20120604 Thunderbird/13.0 MIME-Version: 1.0 To: user@commons.apache.org Subject: Re: [math] Gaussian fitter stalls References: <4FD0C327.1060902@panasys.com> <4FD765E1.80707@panasys.com> <20120612175704.GY10938@dusk.harfang.homelinux.org> In-Reply-To: <20120612175704.GY10938@dusk.harfang.homelinux.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Giles! Thank you very much for creating the unit test - in future, I will do this myself. Thanks also for the analysis - I will try and figure out how to filter the data. Kumar. On 6/12/2012 10:57 AM, Gilles Sadowski wrote: > On Tue, Jun 12, 2012 at 08:53:05AM -0700, B.Kumar wrote: >> Hi all! >> Has anyone had a chance to look at or think about this? >> Thanks! > When you ask for help, please provide a fully-working minimal example, in > the form of a Junit test. This will surely speed things up, both for us and > for you. > In this case, this means a function (say, "testMath798") to be inserted in > the test class for "GaussianFitter", to be found in > src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java > in the source code repository. > >> On 6/7/2012 8:05 AM, B.Kumar wrote: >>> Hi all! >>> This seems to be very similar to the one reported in >>> "https://issues.apache.org/jira/browse/MATH-798 >>> -PolynomialFitter.fit() stalls". >>> When I call the Gaussian fitter.fit() with the following set of points: >>> x : y >>> 0.23 : 395.00 >>> 0.68 : 0.00 <---- >>> 1.14 : 376.00 >>> 1.59 : 0.00 <---- >>> 2.05 : 163.00 >>> 2.50 : 0.00 <---- >>> 2.95 : 49.00 >>> 3.41 : 0.00 <---- >>> 3.86 : 16.00 >>> 4.32 : 0.00 <---- >>> 4.77 : 1.00 >>> it never returns. >>> Thanks for looking into this as well. >>> B.Kumar > I created the unit test, and indeed it doesn't find an answer. > And that's because of the data points which I marked with an arrow above. > If you plot the data, it is hard to expect that a Gaussian will fit them. > [The more so with the pretty stringent default convergence thresholds.] > > If you loosen (a lot) the convergence criteria (e.g. by using an explicit > "SimpleVectorValueConvergenceChecker" with a relative tolerance of 1e-3), > the parameters are found to be > p=[5001984.039785841, -23.740947813999718, 5.457232049164412] > I.e. your data is fitted by the tail of a very, very, very tall Gaussian. > > I guess that it's not what you want. > More likely is that you should filter out the data so that only those points > that are "fairly well" approximated by a Gaussian remain. [This part is not > done by Commons Math.] > Thus (manually) removing those points in the above data set, the fit > produces: > p=[420.8397296167364, 0.603770729862231, 1.0786447936766612] > even with very stringent tolerances (1e-15). > > > HTH, > Gilles > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org