# How is vector A converted to single value scalar in Andrew Ng's course?

In Andrew Ng's deep learning course on Coursera, how is a single scalar value obtained from a flattened image (feature vector)? First there is $$w.T$$ of shape $$(1, n_X)$$ which is multiplied by $$X$$ of shape $$(n_X, 400)$$, so by the laws of linear algebra, the remaining vector is of shape $$(1, 400)$$. This is then passed through Sigmoid to form vector A, and the shape remains at $$(1, 400)$$. How is this vector then converted to a binary scalar value ($$0$$ or $$1$$) for prediction $$y$$-hat?

• Do you mean how to convert a probability to a binary value? (Sigmoid tends to be used on the final layer to give probabilities.) – Dave Jul 4 '20 at 22:13
• Please add link of the video, or put an Image – 10xAI Jul 5 '20 at 11:23

$$n_X$$ is the number of feature, $$400$$ is the number of data.
Each of the entry of $$A$$ is the output of the sigmoid layer, it is between $$0$$ and $$1$$. We can then decide a threshold (typically $$0.5$$) such that if it is at least the threshold, we map it to $$1$$, otherwise, we map it to $$0$$.