Set model weights and bias
Much like linear regression, we need a shared variable weight matrix for logistic regression. We initialize both W and b as tensors full of zeros. Since we are going to learn W and b, their initial value doesn't matter too much. These variables are the objects that define the structure of our regression model, and we can save them after they've been trained so that we can reuse them later.
We define two TensorFlow variables as our parameters. These variables will hold the weights and biases of our logistic regression and they will be continually updated during training.
Notice that W has a shape of [4, 3] because we want to multiply the 4-dimensional input vectors by it to produce 3-dimensional vectors of evidence ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access