bugGNU Octave - Bugs: bug #65170, [octave forge] (statistics)...

 
 

bug #65170: [octave forge] (statistics) Failing BIST in fitcknn

Submitter:  Rafael Laboissière <rlaboiss>
Submitted:  Tue 16 Jan 2024 05:07:27 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 07 Mar 2024 06:34:58 PM UTC, comment #5: 

This can be closed

Andreas Bertsatos <pr0m1th3as>
Sun 21 Jan 2024 03:23:18 PM UTC, comment #4: 
Andreas Bertsatos <pr0m1th3as>
Wed 17 Jan 2024 11:09:52 AM UTC, comment #3: 

Although the notion of bug-to-bug compatibility appeals to my sense of humor, we 'd rather avoid it in Octave's functionality. I will push the changes (hopefully today or tomorrow) to statistics and make a new release, so that the release bundled in Octave 9.1 does not maintain bug compatibility with Matlab.

Andreas Bertsatos <pr0m1th3as>
Tue 16 Jan 2024 11:02:11 PM UTC, comment #2: 

I think it is one of those "WTF Matlab?" bugs and Andreas wants to be bug-for-bug compatible with matlab.


octave:32> c = cov(x)
c =

   6.250000000000000e+00   6.750000000000000e+00   7.250000000000000e+00
   6.750000000000000e+00   8.250000000000000e+00   9.750000000000000e+00
   7.250000000000000e+00   9.750000000000000e+00   1.225000000000000e+01

octave:33> 4*c
ans =

   25   27   29
   27   33   39
   29   39   49


and one can easily calculate with pen and paper (or perhaps with some symbolic math software) that det(4*c) is exactly 0.
So "c" is NOT positive definite.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Tue 16 Jan 2024 05:24:51 PM UTC, comment #1: 

possibly related to
https://octave.discourse.group/t/octave-possible-bug-inconsistencies-with-chol-and-isdefinite/5162/69 ?  is there already a bug report on chol issues?

Nicholas Jankowski <nrjank>
Group Member
Tue 16 Jan 2024 05:07:27 PM UTC, original submission:  

One of the BISTs of function fitcknn of the statistics package, version 1.6.1, is failing:


octave:1> pkg load statistics
octave:2> test fitcknn
***** test
 x = [1, 2, 3; 4, 5, 6; 7, 8, 9; 3, 2, 1];
 y = ["a"; "a"; "b"; "b"];
 C = cov (x);
 a = fitcknn (x, y, "Cov" , C, "distance", "mahalanobis");
 assert (class (a), "ClassificationKNN");
 assert ({a.DistParameter}, {C})
 assert ({a.NSMethod, a.Distance}, {"exhaustive", "mahalanobis"})
 assert ({a.BucketSize}, {50})
!!!!! test failed
ClassificationKNN: Cov must be a symmetric positive definite matrix.


According to the documentation, the argument "Cov" must be a positive definite matrix. Now, in the BIST above, the C matrix is not positive definite. Indeed:


octave:3> x = [1, 2, 3; 4, 5, 6; 7, 8, 9; 3, 2, 1];
octave:4> C = cov (x);
octave:5> [~, p] = chol (C)
p = 3



Rafael Laboissière <rlaboiss>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pr0m1th3as (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by rlaboiss (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-03-07 nrjank StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-3736.
    Corresponding source code