I got the same answers but with a negative. all the other tests pass.
i checked the answer using Python PCA. I got the negative answer??
Expected: [[ 0.43437323 0.49820384]
[ 0.42077249 -0.50351448]
[-0.85514571 0.00531064]].
Got: [[-0.43437323 -0.49820384]
[-0.42077249 0.50351448]
[ 0.85514571 -0.00531064]].
Hi @Fares_Bagh
Could this be related? Can you private message (by clicking on my avatar) your assignment (how to download)?
I think you will not pass the Assignment by using imported libraries like sklearn unless you would have been asked to, and in this course you are never asked for that inside “### START CODE HERE ###” and “### END CODE HERE ###”.
I’m afraid that in order to pass, you need to follow the instructions.
Not worried about passing. I used the liberary because i have the same problem with the math you suggested. But you should not you be curious was the number conflict with a common library???
Yes, I’m all for curiosity
My previous answer was to:
And regarding your initial question it’s very hard to predict how you came up with the results without knowing what you did.
thanks for you help. I will take a stab at doing it as described in the outline.
I may come to you with questions
thanks again.
I would be happy to help
I’m looking forward to. Even if you won’t have questions, it would be informative for everyone to know what your conclusions are and what you did to arrive to them. So please, share with us your results
once I figure this out I will compare the outcome to Python PCA package
I think my rowvar is wrong in covariance
Hi @Fares_Bagh
Please remove your code because it’s against the rules. I responded you personally through DM.
For future readers, if you getting these results, chances are that when calculating X_demeaned
you are not subtracting the mean from X
- but the other way around - you are subtracting X
from the mean (which is different and wrong result). In other words:
x - mean \neq mean - x
P.S. however, the original question “why the results differ from the sklearn.decomposition.PCA
” is still unanswered
apologies I thought this was DM communication
removed the code to comply iwth the rulese
Hi How do i know i am using DM vs. posting that everyone sees
Hi @Fares_Bagh
Short answer:
-
For public communication you would see this (“Vote” and Path) at the top:
-
Private messages would have this (Envelope) at the top:
I know this is not very obvious at first, but it’s something that one can get used to.
thanks. getting bit more proficient with your help
Hi again
what is the best way to upload a file from work area to the assignment. Thanks
Hi @Fares_Bagh
When you are not sure what you’re doing the best way is to have a fresh copy of your assignment and fill in between “Start code here” … “End code here” with simple copy / paste.
One of the ways for uploading files to the Environment is “File” → “Open” then choosing “Upload” button on the right.
Cheers
Hi
what is the best way to share code with you
Hi again
my lab code is vmpvhgpftjzh
my code is spending abnormally long time in the nearest neighbor function
example
in:- 2023-05-09 19:55:38.673048
out:- 2023-05-09 19:55:41.829051
almost 3 minutes. then you multiply by ~1400. and you get the vert long time.
The function pass the specific test fine and fast but may because smaller vectors are used.
probably i doing looping in a dumb way