我正在使用Python中MLPY API的PCAFast
方法。
当学习如下生成的特征矩阵时,该方法执行得非常快:
x = np.random.rand(100, 100)
此命令的示例输出为:
[[ 0.5488135 0.71518937 0.60276338 ..., 0.02010755 0.82894003
0.00469548]
[ 0.67781654 0.27000797 0.73519402 ..., 0.25435648 0.05802916
0.43441663]
[ 0.31179588 0.69634349 0.37775184 ..., 0.86219152 0.97291949
0.96083466]
...,
[ 0.89111234 0.26867428 0.84028499 ..., 0.5736796 0.73729114
0.22519844]
[ 0.26969792 0.73882539 0.80714479 ..., 0.94836806 0.88130699
0.1419334 ]
[ 0.88498232 0.19701397 0.56861333 ..., 0.75842952 0.02378743
0.81357508]]
但是,当要素矩阵x
由以下数据组成时:
x = 7.55302582e-05*np.ones((100, 100))
示例输出:
[[ 7.55302582e-05 7.55302582e-05 7.55302582e-05 ..., 7.55302582e-05
7.55302582e-05 7.55302582e-05]
[ 7.55302582e-05 7.55302582e-05 7.55302582e-05 ..., 7.55302582e-05
7.55302582e-05 7.55302582e-05]
[ 7.55302582e-05 7.55302582e-05 7.55302582e-05 ..., 7.55302582e-05
7.55302582e-05 7.55302582e-05]
...,
[ 7.55302582e-05 7.55302582e-05 7.55302582e-05 ..., 7.55302582e-05
7.55302582e-05 7.55302582e-05]
[ 7.55302582e-05 7.55302582e-05 7.55302582e-05 ..., 7.55302582e-05
7.55302582e-05 7.55302582e-05]
[ 7.55302582e-05 7.55302582e-05 7.55302582e-05 ..., 7.55302582e-05
7.55302582e-05 7.55302582e-05]]
方法变得非常慢......
为什么会这样?
这是否与x
特征矩阵中存储的数据类型有关?
关于如何解决这个问题的任何想法?