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

 
 

bug #59804: [octave forge] (statistics) 1.4.2 - fitgmdist - dimension mismatch check inappropriately fails for non-shared Sigma

Submitter:  Tasos Papastylianou <tpapastylianou>
Submitted:  Sat 02 Jan 2021 05:15:07 PM UTC
 
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Tasos Papastylianou Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Fri 12 Aug 2022 12:39:17 PM UTC, comment #1: 

Fixed bug and added demos. Commit b9ecb09 pushed at https://github.com/gnu-octave/statistics/commit/b9ecb09f8c72d96a241dcbe064c9338cb55d63ac
Closed.

Andreas Bertsatos <pr0m1th3as>
Sat 02 Jan 2021 05:15:07 PM UTC, original submission:  

Please see https://stackoverflow.com/a/65530418/4183191 for context and more details.
Note, my 'fix' in that SO article is only a hacky workaround, not really a proper mismatch check in that sense; I assume the maintainer will want to conduct a more comprehensive validation...

In summary, line 197 performs the following check:

if (any (size (data, 2) ~= [size(mu,2), size(Sigma)]) || any (k ~= [size(mu,1), size(p,2)]))
  error ('fitgmdist: Start parameter has mismatched dimensions');
endif

This line is a bit convoluted, but effectively it says the following:
Fail the mismatch check if ANY of the following is true:
1. There is a mismatch between number of features (columns) 'n' in the data, and features (columns) in the mean.
2. There is a mismatch between number of features (columns) 'n' in the data, and ANY of the dimensions of Sigma
3. There is a mismatch between number of components 'k', and number of components (rows) in the mean
4. There is a mismatch between number of components 'k', and number of components (columns) in the component weights (i.e. ComponentProportion)

The error in logic lies in step 2. This would only pass the check in the case of a shared covariance, in which case you would expect Sigma to be a 2D array, of size n×n, and therefore the check any( n ~= [n,n] ) will be false (i.e. no evidence of mismatch). However, in the typical case where Sigma is expected to be n×n×k (one 2D covariance matrix per component considered, stacked along the 3rd dimension), this check will be flagged as true (i.e. evidence of mismatch, since n ~= k), and therefore the code will exit with a dimension mismatch error, instead of accepting an otherwise valid n×n×k Sigma.

Tasos Papastylianou <tpapastylianou>

 

(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 nrjank (Updated the item)
  • -email is unavailable- added by pr0m1th3as (Posted a comment)
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by tpapastylianou (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 project members can vote.

     

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-12 nrjank StatusNone Fixed
        Open/ClosedOpen Closed
    2021-01-02 mmuetzel Release6.1.0 other
        Summarystatistics-1.4.2 - fitgmdist - dimension mismatch check inappropriately fails for non-shared Sigma [octave forge] (statistics) 1.4.2 - fitgmdist - dimension mismatch check inappropriately fails for non-shared Sigma

    Back to the top


    Powered by Savane 3.9