Vector dot product is widely used in machine learning. In this tutorial, we will introduce it for machine learning beginners.
What is vector dot product?
Given two vectors A and B, the dot product between them are defined as:
We can find the result of two vector dot product is a scalar.
The difference between vector dot product and element-wise multiplication
Vector dot product is different from element-wise multiplication, the element-wise multiplication (product) can be defined as:
From above, we can find:
dot product(A, B) = sum(element-wise multiplication(A, B))
How to calculate the vector dot product?
We can use tf.tensordot() function to compute.
We can use numpy.dot() to compute.