Inversion of a singular matrix

3 ビュー (過去 30 日間)
Alba GC
Alba GC 2021 年 11 月 8 日
編集済み: Matt J 2021 年 11 月 8 日
Hello everyone,
I have a question that may sound akward, but I need to know. First, let me recall the discriminant function for a k-classes classification problem with Linear Discriminant Analysis (LDA).
I have a binary classification problem with a predictor matrix (X) of sizes NxK = 29x1018. I woud not expect a solution with LDA, given that the resulting covariance matrix would not be invertible. However, when I applied the fitcdiscr.m function it returns me a solution. Nonetheless, when I check the determinant of the covariance matrix (returned as an output from the returned Classification Discriminant object), it is, indeed, null.
So, do you have any explanation for this? I guess that the function internally does some type of "trick" to get an invertible matrix, but I could not reach that level of depth even by looking inside the matlab code (or maybe I am just missing something).
Find attached an example of X and Y elements slong with the code lines used to fit the LDA model and to check the determinant of the returned covariance matrix:
MdlLinear = fitcdiscr(xtrain,ytrain);
det(MdlLinear.Sigma)
Thank you so much in advance

採用された回答

Matt J
Matt J 2021 年 11 月 8 日
編集済み: Matt J 2021 年 11 月 8 日
I don't know what fitcdiscr does internally, but we can be quite certain Matlab would never invert a matrix explicitly, even if it were non-singular. To calculate , it would instead solve the system of equations . The solutions to these equations are non-unique in this case, but Matlab has many linear solvers at its disposible that will extract one of the solutions from a singular system.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscriminant Analysis についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by