algorithm - Python - How to find a correlation between two vectors? -
Let me locate them by looking at two vectors X and y Correlation, that is, their linear dependency / independence are both dimensions similar to the vectors. Results [-1.0] 1.0] should be a floating point number.
Example:
x = [- 1, 2, 0] y = [4 = (X, Y) Search [- 1.0 .. 1.0] . It should be a simple creation that includes list-understanding. No external library is allowed. Update: OK, if dot product is enough then here's my solution:
nx = 1 / (sum (x for x for x * x)) ** 0.5) NY = 1 / (y (Y for y in y)) ** 0.5) cor = sum ((x * nx) * x (y * ny) x, z in zip (x, y)])
Right?
Resolve the equation of the cosine angle between two vectors, which is always in the range of [1, 1], and what will happen to you
The split dot is equal to the product.
Comments
Post a Comment