Skip to content

Instantly share code, notes, and snippets.

@Muhammad-Yunus
Created April 10, 2020 07:41
Show Gist options
  • Save Muhammad-Yunus/a93867b4fa325513dd282aca4131fce2 to your computer and use it in GitHub Desktop.
Save Muhammad-Yunus/a93867b4fa325513dd282aca4131fce2 to your computer and use it in GitHub Desktop.
Single Laer Perceptron - Logic AND (plot lineary sparable class)
# plot lineary separable class (logic AND)
plot_x = np.array([np.min(x[:, 0] - 0.2), np.max(x[:, 1]+0.2)])
plot_y = - 1 / W[1] * (W[0] * plot_x + b)
print('W:' + str(W))
print('b:' + str(b))
print('plot_y: '+ str(plot_y))
plt.scatter(x[:, 0], x[:, 1], c=y, s=100, cmap='viridis')
plt.plot(plot_x, plot_y, color='k', linewidth=2)
plt.xlim([-0.2, 1.2]); plt.ylim([-0.2, 1.25]);
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment