#用np处理iris数据集
iris = datasets.load_iris()
binary_target = np.array([1.if x == 0else0.for x in iris.target])
iris_2d = np.array([ [x[2],x[3]] for x in iris.data ])
A = tf.Variable(tf.random_normal(shape=[1,1]))
b = tf.Variable(tf.random_normal(shape=[1,1]))
#这段就相当于用特征x1_data,x2_data来计算出my_output最终根据my_output来判断物体当前类别。
my_mult = tf.matmul(x2_data,A)
my_add = tf.add(my_mult,b)
my_output = tf.sub(x1_data, my_add)
#已知A,b用np把那条分类线画出来
[[slope]] = sess.run(A)
[[intercept]] = sess.run(b)
#这相当于曲线展示的时候的横坐标
x = np.linspace(0, 3, num = 50)
y = []
for i in x:
y.append(slope*i + intercept)
plt.plot(x, y, 'b--')