# python查看矩阵的行列号以及维数方式

print(X.shape):查看矩阵的行列号

print(len(X)):查看矩阵的行数

print(X.ndim):查看矩阵的维数

1 查看矩阵的行列号

2 查看矩阵的行数

3 查看矩阵的维数

numpy模块。

```import numpy as np

def nonlin(x,deriv=False):
if (deriv==True):
return x*(1-x)
return 1/(1+np.exp(-x))

#input dataset
x=np.array([[0.05, 0.07, 1.26, 51，128983, 37.180962, 149.0759784, 4.368080458, 1.0132,  24.4777],
[0.54, 0.18, 0.34, 30.83226759, 39.7490114, 12.70335148, 5.792655734, 4.66,  1.57],
[0.47, 0.95, 2.01, 38.01532298, 3.080286601, 89.59062789, 5.349154432, 1.05,  0.461],
[0.81, 1.06, 1.3, 77.882162, 59.17737344, 124.9541366, 5.259286248, 0.2105,  1.706]])
#output dataset
y=np.array([[15, 26, 33, 64]]).T
np.random.seed(1)
syn0=2*np.random.random((9,1))-1

for iter in range(10000):
l0=x
l1=nonlin(np.dot(l0,syn0))
l1_error=y-l1
l1_delta=l1_error*nonlin(l1,True)
syn0+=np.dot(l0.T,l1_delta)
print ("Outout after training:")
print (l1)
```

```#input dataset
x=np.array([[0.05, 0.07, 1.26, 51，128983, 37.180962, 149.0759784, 4.368080458, 1.0132,  24.4777],
[0.54, 0.18, 0.34, 30.83226759, 39.7490114, 12.70335148, 5.792655734, 4.66,  1.57],
[0.47, 0.95, 2.01, 38.01532298, 3.080286601, 89.59062789, 5.349154432, 1.05,  0.461],
[0.81, 1.06, 1.3, 77.882162, 59.17737344, 124.9541366, 5.259286248, 0.2105,  1.706]])```

```#input dataset
x=np.array([[0.05, 0.07, 1.26, 51.128983, 37.180962, 149.0759784, 4.368080458, 1.0132,  24.4777],
[0.54, 0.18, 0.34, 30.83226759, 39.7490114, 12.70335148, 5.792655734, 4.66,  1.57],
[0.47, 0.95, 2.01, 38.01532298, 3.080286601, 89.59062789, 5.349154432, 1.05,  0.461],
[0.81, 1.06, 1.3, 77.882162, 59.17737344, 124.9541366, 5.259286248, 0.2105,  1.706]])```