How are the values of trig functions like numpy.cos()
computed? Are lookup tables used to speed the process or does it try to actually compute cosine on-the-fly to some level of accuracy? Is this the same for sklearn, like sklearn.metrics.pairwise.cosine_similarity()
?
Asked
Active
Viewed 271 times
0

TheSneak
- 500
- 6
- 15
-
Possible duplicate of [How does C compute sin() and other math functions?](https://stackoverflow.com/questions/2284860/how-does-c-compute-sin-and-other-math-functions) – MB-F May 09 '19 at 07:53
-
Numpy uses C functions for such computations... For information on the C implementation see the duplicate link above. Sklearn usually uses numpy functions. However, in the particular case of `cosine_similarity` no trigonometric functions are ever computed. – MB-F May 09 '19 at 07:59