diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 04a9610..91d14f8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -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]) + + + + + + +