Skip to content

Instantly share code, notes, and snippets.

@SzateX

SzateX/learn.py Secret

Last active May 14, 2018 20:04
Show Gist options
  • Save SzateX/d5ad41bbc355347342efc345b447b942 to your computer and use it in GitHub Desktop.
Save SzateX/d5ad41bbc355347342efc345b447b942 to your computer and use it in GitHub Desktop.
x_data = tf.placeholder(shape=[None, 4], dtype=tf.float32)
y_target = tf.placeholder(shape=[None, 1], dtype=tf.float32)
A2 = tf.Variable(tf.random_normal(shape=[first_layer_nodes, 1])) # first_layer nodes -> sum node
c = tf.Variable(tf.random_uniform([first_layer_nodes, 4], dtype=tf.float32)) # centroids
exp_list = []
for i in range(first_layer_nodes):
euclid_distance = tf.reduce_sum(tf.square(tf.subtract(x_data, c[i, :])), 1)
exp_list.append(tf.exp(-SC * euclid_distance))
phi = tf.transpose(tf.stack(exp_list))
final_output = tf.matmul(phi, A2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment