def feed_forward(self, input: ndarray) -> ndarray: self.sum_cache = np.dot(self.weights, input.T).T + self.bias self.output_cache = sigmoid(self.sum_cache) return self.output_cache
elif operator == 2: result = subtraction(num1, num2) elif operator == 3: result = multiplication(num1, num2) elif operator == 4: result = division(num1, num2) elif operator == 5: result = integer_division(num1, num2) elif operator == 6: result = power(num1, num2) elif operator == 7: result = modulo(num1, num2) elif operator == 8: result = log(num1, num2) elif operator == 9: result = sigmoid(num1 + num2) elif operator == 10: result = rand_between(num1, num2) elif operator == 11: result = hcf(num1, num2) elif operator == 12: result = factorial(num1) elif operator == 13: result = exponential(num1) elif operator == 14: result = Sine() elif operator == 15: result = Cosine() elif operator == 16: result = Tangent() elif operator == 17:
#!/usr/bin/env python #! -*- coding: utf-8 -*- """ Build a perceptron that classifies a point between two sets which are divided by a line between (4,0) and (0,4). """ from graph import Graph from graph import Variable from graph import Placeholder from operations import matmul from operations import add from operations import sigmoid from session import Session # Create a new graph Graph().as_default() x = Placeholder() w = Variable([1, 1]) b = Variable(0) p = sigmoid(add(matmul(w, x), b)) # Let's try it to calculate the probability for point (3,2)T # being a blue point (being over the line or p(wTx+b) > 0.5) session = Session() print(session.run(p, {x: [3, 2]}))