Created
August 1, 2023 10:12
-
-
Save galihboy/56c885a42401854b2db770aaf830aca1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# JST -> Feed Forward | |
# DEMO Operasi Logika AND | |
import numpy as np | |
# Fungsi aktivasi Step | |
def step(x): | |
return 1 if x >= 1 else 0 | |
# Data pelatihan | |
input_data = np.array([[0, 0], | |
[0, 1], | |
[1, 0], | |
[1, 1]]) | |
# Inisialisasi bobot untuk output | |
output_layer_weights = np.array([0.75, 0.75]) | |
# Forward propagation dengan fungsi aktivasi Step tanpa lapisan tersembunyi | |
output = np.dot(input_data, output_layer_weights) | |
output = np.vectorize(step)(output) | |
# Hasil output dari JST | |
print("Hasil output dari JST:") | |
print(output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment