Created
August 1, 2023 10:13
-
-
Save galihboy/04b5030075ab56e50f15d40ced4e5106 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 OR | |
import numpy as np | |
# Fungsi aktivasi Step | |
def step(x): | |
return 1 if x >= 2 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([2, 2]) | |
# 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