octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #52120] [octave forge] (optim) Random failure


From: Rafael Laboissiere
Subject: [Octave-bug-tracker] [bug #52120] [octave forge] (optim) Random failure of nlinfit unit test
Date: Tue, 26 Sep 2017 11:29:13 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?52120>

                 Summary: [octave forge] (optim) Random failure of nlinfit
unit test
                 Project: GNU Octave
            Submitted by: rlaboiss
            Submitted on: Tue 26 Sep 2017 03:29:11 PM UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: other
        Operating System: Any

    _______________________________________________________

Details:

In version 1.5.2 of the optim package, the unit test for function nlinfit is
failing randomly:


octave:1> pkg load optim
octave:2> while 1 ; test nlinfit ; endwhile
PASSES 1 out of 1 test
[…]
PASSES 1 out of 1 test
***** test
 modelfun = @(b, x) (b(1) + b(2) * exp (- b(3) * x));
 b = [1;3;2];
 xdata = exprnd (2,100,1);
 ydata = modelfun (b,xdata) + normrnd (0,0.1,100,1);
 beta0 = [2;2;3];
 beta = nlinfit(xdata,ydata,modelfun,beta0);
 assert (beta, [1;3;2], 1e-1)
!!!!! test failed
ASSERT errors for:  assert (beta,[1; 3; 2],1e-1)

  Location  |  Observed  |  Expected  |  Reason
    (3)         1.8854         2         Abs err 0.11464 exceeds tol 0.1


This happens because the unit test calls exprnd and normrnd, such that the
values passed to nlinfit are unpredictable.

The patch attached to this bug report contains a possible fix for the problem.
 Essentially, it sets the seed of the random number generators in question. It
takes care of keeping the state of those RNGs.  Please, consider applying it
to the sources or implementing a reproducible way of running the unit test for
nlinfit. 



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Tue 26 Sep 2017 03:29:11 PM UTC  Name:
reproducible-nlinfit-unit-test.patch  Size: 822B   By: rlaboiss

<http://savannah.gnu.org/bugs/download.php?file_id=41896>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52120>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]