我有以下情况:
我先加载mnist数据,然后再计算前500个样本的协方差矩阵。
traind, testd, trainl, testl = np.load(open("mnist.npz","rb")).values()
first500 = traind[0:500]
covariancematrix = first500.reshape(500,-1,1)*first500.reshape(500,1,-1)
这将为我提供每个样本的协方差矩阵,所以我有500x784x784。
我现在的问题是,我可以使用给定的np.outer函数的numpy吗?