Hello, I'm having trouble implementing a neural network. My problem is that I can only implement it with an 'X' attribute
I need help in this code for example, how do I put two input attributes? In the case of this code only has the attribute X I wanted to put another attribute that also influences the formula something like: linear_model = W1 * x1 + W2 * x2 + b
How would the code look?
import tensorflow as tf
W = tf.Variable([.3], dtype = tf.float32)
b = tf.Variable([-.3], dtype = tf.float32)
x = tf.placeholder(tf.float32)
y = tf.placeholder(tf.float32)
linear_model = W * x + b
init = tf.global_variables_initializer()
sess = tf.Session()
sess.run(init)
squared_deltas = tf.square(linear_model - y)
loss = tf.reduce_sum(squared_deltas)
# Teste com aprendizado
optimizer = tf.train.GradientDescentOptimizer(0.01)
train = optimizer.minimize(loss)
sess.run(init) #reset values to incorrect defaults
for i in range(1000):
sess.run(train, {x: [1, 2, 3, 4], y: [0, -1, -2, -3]})
print(sess.run([W, b]))