Why I get two different covariance matrix?
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (1)
4 comentarios
John D'Errico
el 14 de Jul. de 2022
Editada: John D'Errico
el 14 de Jul. de 2022
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
el 14 de Jul. de 2022
John D'Errico
el 14 de Jul. de 2022
Editada: John D'Errico
el 14 de Jul. de 2022
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
el 14 de Jul. de 2022
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!