ajmal code
ajmal code
ipynb - Colab
import numpy as np
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def sigmoid_derivative(x):
return x * (1 - x)
class MLP:
def __init__(self):
self.input_weights = np.random.rand(2, 2)
self.hidden_weights = np.random.rand(2, 1)
self.hidden_bias = np.random.rand(1, 2)
self.output_bias = np.random.rand(1, 1)
OR Gate Results:
Input: [0 0], Output: [[0.]]
Input: [0 1], Output: [[1.]]
Input: [1 0], Output: [[1.]]
Input: [1 1], Output: [[1.]]
https://colab.research.google.com/drive/1YO0uWodxUmtXMqkaQ2EziH50lCZGb__L#scrollTo=sBI03_xrwXDZ&printMode=true 1/2
12/23/24, 11:37 PM Untitled25.ipynb - Colab
https://colab.research.google.com/drive/1YO0uWodxUmtXMqkaQ2EziH50lCZGb__L#scrollTo=sBI03_xrwXDZ&printMode=true 2/2