Why I get two different covariance matrix?
古いコメントを表示
Hi all,
Prof. Andrew Ng in his ML class says that we can calculate covariance matrix as: 1/m*X'*X .
Where;
examples are in rows of X,
X' is transpose of X,
and, m is number of examples.
For example:
X=randi(12,[6,2]);
cov1=1/size(X,1)*X'*X
And, covariance with cov function is:
cov2=cov(X)
As you can see, cov1 is different from cov2 !!!
What is the reasan for that? Do you have any idea?
Thanks
採用された回答
その他の回答 (1 件)
4 件のコメント
John D'Errico
2022 年 7 月 14 日
編集済み: John D'Errico
2022 年 7 月 14 日
PLEASE DON"T ASK a new question as an answer to your own question! In fact, I won't answer a question posed as you have done, and I could probably do so.
ali yaman
2022 年 7 月 14 日
John D'Errico
2022 年 7 月 14 日
編集済み: John D'Errico
2022 年 7 月 14 日
Since this is probably of some general interest, I'll actually post a question of my own, then answer it myself, discussing the relative issues between eig and svd.
ali yaman
2022 年 7 月 14 日
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!