Skip to content

Instantly share code, notes, and snippets.

@Muhammad-Yunus
Last active April 10, 2020 06:50
Show Gist options
  • Save Muhammad-Yunus/4832c15589d1c04b7290935523b0a599 to your computer and use it in GitHub Desktop.
Save Muhammad-Yunus/4832c15589d1c04b7290935523b0a599 to your computer and use it in GitHub Desktop.
Single Layer Perceptron - logic AND Problem
import numpy as np
import matplotlib.pyplot as plt
NUM_FEATURES = 2
NUM_ITER = 100
learning_rate = 0.1
x = np.array([[0,0],[0,1],[1,0],[1,1]], np.float32)
y = np.array([0, 0, 0, 1], np.float32)
# initial weight & bias
W = np.zeros(NUM_FEATURES, np.float32)
b = np.zeros(1, np.float32)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment