Skip to content

Instantly share code, notes, and snippets.

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