Exercises / math
Cosine similarity
Implement cosine(a, b) with stdlib math. Zero-norm vectors return 0.0. Print cosine of [1,0] with [1,0], [0,1], and [0,0].
Live Pythonpython
Output
Run to execute this in your browser. Nothing is sent to a server.
Exercises / math
Implement cosine(a, b) with stdlib math. Zero-norm vectors return 0.0. Print cosine of [1,0] with [1,0], [0,1], and [0,0].
Run to execute this in your browser. Nothing is sent to a server.