Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# Codeowners for these exercise files:
# * (asterisk) denotes "all files and folders"
# Example: * @producer @instructor
import numpy as np
class perceptron:

def __init(self, inputs, bias=1.0):
self.weights = (np.random.rand(inputs+1)*2)-1
self.bias = bias
print(self.weights)

def run(self,x):
n=len(x)
output=0
for i in range(n):
output+=x[i] * weights[i]+bias * weights[-1]

x_sum = np.dot(np.append(x,bias),weights)
return sigmoid(x_sum)

def sigmoid(self, x):
return 1/(1+np.exp(-x))

def set_weights(self,w_init):
self.weights = np.array(w_init)

run([0,10])