I have fairly simple code to calculate mean. Basically I am reading mnist data, find the PCA and finding the mean of PCA1 and PCA2. The first few columns of PCA1, PCA2 are shown below. I am trying to find the mean of that data. I am confused how the mean could be something like e -power- negative 14. Something is going wrong. I tried plain np.mean with axis=0, then nanmean - still the mean looks way off. If I chop off the last row it seemed to work at times. That is not consistent. The mean seems to be way out of range. The minimum is something like -1550 and max is like 1400 and for column 2 - 1300 to +2200. The mean could not be that small like e to power -14.
Please help.
Please help.
def findMean(X): X = X.astype('float64') badMU=np.nanmean(X,axis=0); print("from inside findMean print two rows of mean" ) print(badMU[0:2]) return badMUHere is the output - excerpt only.
Output:Print columns 1 and 2 of 5 rows of P i.e., P[:5,0:2]
[[ -177.01262488 -1123.38369215]
[ -486.95502974 953.72782595]
[ -701.57667656 722.54538116]
[ -739.68606132 625.34125527]
[ 496.35283147 -371.99788225]]
Recovering X
Test overall mean of P - just print a few cols
from inside findMean print two rows of mean
[ -3.54114684e-14 -1.08559058e-14]
get min and max for col0 and col1 from P
Num entries in P is = 12593