[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #59804] statistics-1.4.2 - fitgmdist - dimensi
From: |
Tasos Papastylianou |
Subject: |
[Octave-bug-tracker] [bug #59804] statistics-1.4.2 - fitgmdist - dimension mismatch check inappropriately fails for non-shared Sigma |
Date: |
Sat, 2 Jan 2021 12:15:09 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0 |
URL:
<https://savannah.gnu.org/bugs/?59804>
Summary: statistics-1.4.2 - fitgmdist - dimension mismatch
check inappropriately fails for non-shared Sigma
Project: GNU Octave
Submitted by: tpapastylianou
Submitted on: 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: None
Assigned to: None
Originator Name: Tasos Papastylianou
Originator Email:
Open/Closed: Open
Release: 6.1.0
Discussion Lock: Any
Operating System: Any
_______________________________________________________
Details:
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.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59804>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #59804] statistics-1.4.2 - fitgmdist - dimension mismatch check inappropriately fails for non-shared Sigma,
Tasos Papastylianou <=