>>>temp = ones((3, 1)) #创建数组
>>>temp
array([[ 1.],
[ 1.],
[ 1.]])
>>>weights = mat(w) #转换为numpy矩阵
>>>weights
matrix([[ 1.],
[ 1.],
[ 1.]])
>>>s = weights.getA() #将numpy矩阵转换为数组
>>>s
array([[ 1.],
[ 1.],
[ 1.]])
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
从上述结果中可以看书getA()函数与mat()函数的功能相反,是将一个numpy矩阵转换为数组