Quick actions

cmd+k|ctrl+k

Navigation

Languages

Neural Netwok

Snippet info

Language

Python

Visibility

public

Author

jonreygalera

Created

2025-04-25T00:20:16.932239Z

Updated

2025-04-25T00:28:48.753711Z

import numpy as np

""" lets say:
Your inputs: x1 =2 (math score), x2 = 3 (science score)
Weights: w1 = 0.5, w2 = 0.1 (how important each subject is)
Bias: b = 1
"""

# activation function
def sigmoid(z):
    return 1 / (1 + np.exp(-z))

# input
X = np.array([2, 3])

# wieghts
w = np.array([0.5, 0.1])

#bias
b = 1

# input(wieghts) product + bias
z = np.dot(X, w) + b

y = sigmoid(z)

print(y)

INFO