commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ole Ersoy (JIRA)" <j...@apache.org>
Subject [jira] Commented: (MATH-519) GaussianFitter Unexpectedly Throws NotStrictlyPositiveException
Date Mon, 21 Feb 2011 20:22:38 GMT

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

Ole Ersoy commented on MATH-519:
--------------------------------

Yes!  I figured out how to quote!

First of all I hope we are talking about this function:
http://en.wikipedia.org/wiki/Gaussian_function

As the objective function right?  If I got that wrong then ignore the below.

{quote}
Anyway, returning NaN or POSITIVE_INFINITY would work only with some optimizers.
{quote}

Seems to me that if the optimizer does not understand POSITIVE_INFINITY then that's a bug.
 

{quote}
If you think is that we can accept a negative sigma as the result of the fitting...
{quote}

No no no - Not at all.  I'm saying that we should let the optimizer try negative values for
sigma if it wants to while it's in the middle of trying to find the optimal sigma.  If it
returns a negative sigma as a result, then we need to throw a NotStrictlyPositiveException.

{quote}
Did you try?
{quote}

I could give it a whirl, but it does not necessarily prove anything.  Even it it converges
quicker, does that mean it will do so in all cases?  It just seems to me like POSITIVE_INFINITE
is as far from the optimal as you can get, and therefore it will take longer to get to the
optimal.

Also, I changed my mind about an earlier comment.  If sigma is zero then the gaussian function
is zero, so we should probably just return zero.


> 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

        

Mime
View raw message