Python 如何从tensorflow中的简单回归预测代码中获得结果?

Python 如何从tensorflow中的简单回归预测代码中获得结果?,python,tensorflow,regression,Python,Tensorflow,Regression,我试图通过编写以下代码来找到回归模型: X1 = tf.placeholder(tf.float32) X2 = tf.placeholder(tf.float32) X3 = tf.placeholder(tf.float32) X4 = tf.placeholder(tf.float32) X5 = tf.placeholder(tf.float32) Y = tf.placeholder(tf.float32) W1 = tf.Variable(tf.random_normal([1

我试图通过编写以下代码来找到回归模型:

X1 = tf.placeholder(tf.float32)
X2 = tf.placeholder(tf.float32)
X3 = tf.placeholder(tf.float32)
X4 = tf.placeholder(tf.float32)
X5 = tf.placeholder(tf.float32)


Y = tf.placeholder(tf.float32)

W1 = tf.Variable(tf.random_normal([1, 1]), dtype = tf.float32,name='weight1')
W2 = tf.Variable(tf.random_normal([1, 1]), dtype = tf.float32,name='weight2')
W3 = tf.Variable(tf.random_normal([1, 1]), dtype = tf.float32, name='weight3')
W4 = tf.Variable(tf.random_normal([1, 1]), dtype = tf.float32,name='weight4')
W5 = tf.Variable(tf.random_normal([1, 1]), dtype = tf.float32,name='weight5')
b1=  b = tf.Variable(tf.random_normal([1]), dtype =  tf.float32 ,name='bias1')

hypothesis = tf.sigmoid(tf.matmul(X1, W1)+tf.matmul(X2, W2)+tf.matmul(X3, W3)+tf.matmul(X4, W4) + tf.matmul(X5, W5) + b1)


cost = -tf.reduce_mean(Y * tf.log(hypothesis) + (1 - Y) * tf.log(1 - hypothesis))
train = tf.train.GradientDescentOptimizer(learning_rate=0.000000000000000001).minimize(cost)

predicted = tf.cast(hypothesis > 0.5, dtype=tf.float32)
accuracy = tf.reduce_mean(tf.cast(tf.equal(predicted, Y), dtype=tf.float32))

with tf.Session() as sess:
   # Initialize TensorFlow variables
   sess.run(tf.global_variables_initializer())
   for step in range(5000):
       sess.run(train, feed_dict={X1:ct, X2: temperature, X3:humidity, X4: windspeed, X5:tideheight, Y:sst})

但是当我打开这个代码时,所有的权重都是Nan值。

您必须将值输入到占位符元素中。见文件。正如你所看到的,他们用了
feed\u dict
来表达同样的意思。

我很尴尬。这是一个简单的代码错误。非常感谢。