Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 18672 invoked from network); 21 Feb 2011 12:20:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Feb 2011 12:20:07 -0000 Received: (qmail 23021 invoked by uid 500); 21 Feb 2011 12:20:06 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 22639 invoked by uid 500); 21 Feb 2011 12:20:03 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 22516 invoked by uid 99); 21 Feb 2011 12:20:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Feb 2011 12:20:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Feb 2011 12:19:59 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 94A2C1AF604 for ; Mon, 21 Feb 2011 12:19:38 +0000 (UTC) Date: Mon, 21 Feb 2011 12:19:38 +0000 (UTC) From: "Gilles (JIRA)" To: issues@commons.apache.org Message-ID: <1653952429.5665.1298290778605.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <110020137.2515.1298090378451.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] Commented: (MATH-519) GaussianFitter Unexpectedly Throws NotStrictlyPositiveException MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/MATH-519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12997370#comment-12997370 ] Gilles commented on MATH-519: ----------------------------- {quote} I'm assuming that the value that results from passing in a negative sigma is closer to the optimal than POSITIVE infinity or NaN [...] {quote} POSITIVE_INFINITY or NaN are the returned values of the objective function and its gradient, specially chosen because they are quite likely to be different from the actual values of the function and its gradient; it's not "sigma" that is assumed to infinity or NaN. If you think is that we can accept a negative sigma as the result of the fitting, I don't agree. In the case of the Gaussian, it's by "chance" that a semantically invalid parameter (negative sigma) would still be usable (as it is being squared before use). In most case you cannot expect such a forgiving situation. For example, if you want to fit "a" in the following function: {noformat} log(a * x) {noformat} no invalid values for "a" are usable. The "Gaussian" class should not be unsafe (no validation of sigma) just because of its particular use here. [Moreover the workaround is useful in showing users how to setup a fitting of a function that can raise an exception.] {quote} [...] and that this will result in faster convergence. {quote} Did you try? > GaussianFitter Unexpectedly Throws NotStrictlyPositiveException > --------------------------------------------------------------- > > Key: MATH-519 > URL: https://issues.apache.org/jira/browse/MATH-519 > Project: Commons Math > Issue Type: Bug > Affects Versions: 3.0 > Reporter: Ole Ersoy > Fix For: 3.0 > > Attachments: GaussianFitter.java, GaussianFitter2Test.java > > Original Estimate: 4h > Remaining Estimate: 4h > > Running the following: > double[] observations = > { > 1.1143831578403364E-29, > 4.95281403484594E-28, > 1.1171347211930288E-26, > 1.7044813962636277E-25, > 1.9784716574832164E-24, > 1.8630236407866774E-23, > 1.4820532905097742E-22, > 1.0241963854632831E-21, > 6.275077366673128E-21, > 3.461808994532493E-20, > 1.7407124684715706E-19, > 8.056687953553974E-19, > 3.460193945992071E-18, > 1.3883326374011525E-17, > 5.233894983671116E-17, > 1.8630791465263745E-16, > 6.288759227922111E-16, > 2.0204433920597856E-15, > 6.198768938576155E-15, > 1.821419346860626E-14, > 5.139176445538471E-14, > 1.3956427429045787E-13, > 3.655705706448139E-13, > 9.253753324779779E-13, > 2.267636001476696E-12, > 5.3880460095836855E-12, > 1.2431632654852931E-11 > }; > > GaussianFitter g = > new GaussianFitter(new LevenbergMarquardtOptimizer()); > > for (int index = 0; index < 27; index++) > { > g.addObservedPoint(index, observations[index]); > } > g.fit(); > Results in: > org.apache.commons.math.exception.NotStrictlyPositiveException: -1.277 is smaller than, or equal to, the minimum (0) > at org.apache.commons.math.analysis.function.Gaussian$Parametric.validateParameters(Gaussian.java:184) > at org.apache.commons.math.analysis.function.Gaussian$Parametric.value(Gaussian.java:129) > I'm guessing the initial guess for sigma is off. -- This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira