Skip to content

Instantly share code, notes, and snippets.

@galihboy
Created August 1, 2023 10:12
Show Gist options
  • Save galihboy/56c885a42401854b2db770aaf830aca1 to your computer and use it in GitHub Desktop.
Save galihboy/56c885a42401854b2db770aaf830aca1 to your computer and use it in GitHub Desktop.
# 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