<p>我一直在读关于tensorflow的指南:<a href="https://medium.com/all-of-us-are-belong-to-machines/the-gentlest-introduction-to-tensorflow-248dc871a224" rel="nofollow noreferrer">https://medium.com/all-of-us-are-belong-to-machines/the-gentlest-introduction-to-tensorflow-248dc871a224</a></p>
<p>……而且,我知道发生了什么。在</p>
<p>但是,<a href="https://github.com/nethsix/gentle_tensorflow/blob/master/code/linear_regression_one_feature.py" rel="nofollow noreferrer">example code</a>中的线性模型定义了如下线性模型:</p>
<pre><code># Model linear regression y = Wx + b
x = tf.placeholder(tf.float32, [None, 1])
W = tf.Variable(tf.zeros([1,1]))
b = tf.Variable(tf.zeros([1]))
product = tf.matmul(x,W)
y = product + b
y_ = tf.placeholder(tf.float32, [None, 1])
# Cost function sum((y_-y)**2)
cost = tf.reduce_mean(tf.square(y_-y))
# Training using Gradient Descent to minimize cost
train_step = tf.train.GradientDescentOptimizer(0.0000001).minimize(cost)
</code></pre>
<p>问题是:为什么<code>Wx + b</code>用这些值表示:</p>
^{pr2}$
<p>是吗?<code>[None, 1]</code>,<code>[1, 1]</code>?为什么<code>[None, 1]</code>代表x,而{<cd3>}代表W?在</p>
<p>如果<code>[1, 1]</code>是1个大小为1的元素,那么为什么b只是<code>[1]</code>,这是什么意思?1个大小为0的元素?在</p>
<blockquote>
<p>For W = tf.Variable, the first '1' is feature, house size, and the 2nd '1' is output, house price.</p>
</blockquote>
<p>这是否意味着如果我试图代表模型,比如:</p>
<pre><code>y = Ax + Bz
</code></pre>
<p>这意味着我有两个“特征”(x和z),我的A值和B值应该是成形的[2,1]?好像不太对劲。。。在</p>
<p>这似乎与<a href="https://github.com/pkmital/tensorflow_tutorials/blob/master/python/03_polynomial_regression.py#L22" rel="nofollow noreferrer">polynomial regression</a>中所做的完全不同,其中权重因子是形状<code>[1]</code>。这有什么不同?在</p>