# Plot decision lines for first layer

Hi guys,

In the multi-class lab (week 2), there is stage where the decision boundary lines for the first layer output are added to the plot:

I tried to do the same by myself, and I don’t know if I did it right
My code is:

line1 = W1[0, 0]/W1[0, 1] * X_train[:, 0] + b1[0]
line2 = W1[1, 0]/W1[1, 1] * X_train[:, 0] + b1[1]

plt.scatter(X_train[:, 0], X_train[:, 1])
plt.plot(line1, X_train[:, 0])
plt.plot(line2, X_train[:, 0])
plt.xlim(-7.7, 7.7)
plt.ylim(-4.5, 4)
plt.show()

and the result I get is:

What do you think? Is this correct or did I miss something?

Hello @Evgy,

It becomes clearer if we write down the first equation and derive from it step-by-step:

Cheers,
Raymond

Thank you Raymond,
Now it looks good

line1 = -W1[0, 0]/W1[0, 1] * X_train[:, 0] - b1[0]/W1[0, 1]
line2 = -W1[1, 0]/W1[1, 1] * X_train[:, 0] - b1[1]/W1[1, 1]

plt.scatter(X_train[:, 0], X_train[:, 1])
plt.plot(X_train[:, 0], line1)
plt.plot(X_train[:, 0], line2)
plt.xlim(-7.7, 7.7)
plt.ylim(-4.5, 4)
plt.show()

That’s good, @Evgy!

Raymond