[jira] Created: (MATH-200) AbstractEstimator: getCovariances() and guessParametersErrors() crash when having bound parameters

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (MATH-200) AbstractEstimator: getCovariances() and guessParametersErrors() crash when having bound parameters

Gary D. Gregory (Jira)
AbstractEstimator: getCovariances() and guessParametersErrors() crash when having bound parameters
--------------------------------------------------------------------------------------------------

                 Key: MATH-200
                 URL: https://issues.apache.org/jira/browse/MATH-200
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 1.2
            Reporter: Plamen Petrov
            Priority: Critical


the two methods getCovariances() and guessParametersErrors() from org.apache.commons.math.estimation.AbstractEstimator crash with ArrayOutOfBounds exception when some of the parameters are bound. The reason is that the Jacobian is calculated only for the unbound parameters. in the code you loop through all parameters.

line #166: final int cols = problem.*getAllParameters()*.length;
should be replaced by:  final int cols = problem.*getUnboundParameters()*.length;
(similar changes could be done in guessParametersErrors())

the dissadvantage of the above bug fix is that what is returned to the user is an array with smaller size than the number of all parameters. Alternatively, you can have some logic in the code which writes zeros for the elements of the covariance matrix corresponding to the bound parameters

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (MATH-200) AbstractEstimator: getCovariances() and guessParametersErrors() crash when having bound parameters

Gary D. Gregory (Jira)

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

Luc Maisonobe commented on MATH-200:
------------------------------------

Since the contract on the two methods is related to the complete parameters array, only the more elaborate fix with specific logic for bound parameters is feasible.

I agree this is a critical error. I will try to provide a fix in the next few days.

Thanks for reporting this.

> AbstractEstimator: getCovariances() and guessParametersErrors() crash when having bound parameters
> --------------------------------------------------------------------------------------------------
>
>                 Key: MATH-200
>                 URL: https://issues.apache.org/jira/browse/MATH-200
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 1.2
>            Reporter: Plamen Petrov
>            Assignee: Luc Maisonobe
>            Priority: Critical
>
> the two methods getCovariances() and guessParametersErrors() from org.apache.commons.math.estimation.AbstractEstimator crash with ArrayOutOfBounds exception when some of the parameters are bound. The reason is that the Jacobian is calculated only for the unbound parameters. in the code you loop through all parameters.
> line #166: final int cols = problem.*getAllParameters()*.length;
> should be replaced by:  final int cols = problem.*getUnboundParameters()*.length;
> (similar changes could be done in guessParametersErrors())
> the dissadvantage of the above bug fix is that what is returned to the user is an array with smaller size than the number of all parameters. Alternatively, you can have some logic in the code which writes zeros for the elements of the covariance matrix corresponding to the bound parameters

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (MATH-200) AbstractEstimator: getCovariances() and guessParametersErrors() crash when having bound parameters

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

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

Plamen Petrov commented on MATH-200:
------------------------------------

Thanks a lot for your quick response!
Best wishes,
Plamen




> AbstractEstimator: getCovariances() and guessParametersErrors() crash when having bound parameters
> --------------------------------------------------------------------------------------------------
>
>                 Key: MATH-200
>                 URL: https://issues.apache.org/jira/browse/MATH-200
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 1.2
>            Reporter: Plamen Petrov
>            Assignee: Luc Maisonobe
>            Priority: Critical
>
> the two methods getCovariances() and guessParametersErrors() from org.apache.commons.math.estimation.AbstractEstimator crash with ArrayOutOfBounds exception when some of the parameters are bound. The reason is that the Jacobian is calculated only for the unbound parameters. in the code you loop through all parameters.
> line #166: final int cols = problem.*getAllParameters()*.length;
> should be replaced by:  final int cols = problem.*getUnboundParameters()*.length;
> (similar changes could be done in guessParametersErrors())
> the dissadvantage of the above bug fix is that what is returned to the user is an array with smaller size than the number of all parameters. Alternatively, you can have some logic in the code which writes zeros for the elements of the covariance matrix corresponding to the bound parameters

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (MATH-200) AbstractEstimator: getCovariances() and guessParametersErrors() crash when having bound parameters

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

     [ https://issues.apache.org/jira/browse/MATH-200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luc Maisonobe resolved MATH-200.
--------------------------------

    Resolution: Fixed

I finally changed my mind and limited the results of both methods to unbound parameters only.
This is more compliant with what user can expect when they bind parameters (a problem with bound parameters should behave exactly as if these parameters were simply constants).
The previous javadoc was not clear about this and the methods did not work at all in this case, so such a change seems wiser to me.

> AbstractEstimator: getCovariances() and guessParametersErrors() crash when having bound parameters
> --------------------------------------------------------------------------------------------------
>
>                 Key: MATH-200
>                 URL: https://issues.apache.org/jira/browse/MATH-200
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 1.2
>            Reporter: Plamen Petrov
>            Assignee: Luc Maisonobe
>            Priority: Critical
>
> the two methods getCovariances() and guessParametersErrors() from org.apache.commons.math.estimation.AbstractEstimator crash with ArrayOutOfBounds exception when some of the parameters are bound. The reason is that the Jacobian is calculated only for the unbound parameters. in the code you loop through all parameters.
> line #166: final int cols = problem.*getAllParameters()*.length;
> should be replaced by:  final int cols = problem.*getUnboundParameters()*.length;
> (similar changes could be done in guessParametersErrors())
> the dissadvantage of the above bug fix is that what is returned to the user is an array with smaller size than the number of all parameters. Alternatively, you can have some logic in the code which writes zeros for the elements of the covariance matrix corresponding to the bound parameters

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.