题目:道理都懂,题目为模式识别这门课的小作业,题目是有错的,(1,1,1,1)是(1,1,1)
代码:
import numpy as np
a = np.array([[0, 0],
[0, 1],
[1, 0],
[1, 1]], dtype=np.float64)
b = np.array([1, 1, 1, 1], dtype=np.float64)
w = np.array([[1],
[1],
[1]], dtype=np.float64)
w2 = np.array([[1, 1, 1]], dtype=np.float64)
x = np.column_stack((a, b))
x[2] = -x[2]
x[3] = -x[3]
x_true = np.matrix(x)
w_true = np.matrix(w)
w2_true = np.matrix(w2)
tag = 0
while tag < 4:
tag = 0
for i in range(4):
&nb