Numy v0.1.5 Numy.Vector.Distance View Source

Distance between 2 points (vectors) in N-dimentional space.

Each element of a vector of size N defines a coordinate in N-dimentional space.

Link to this section Summary

Functions

Example

iex(45)> x = Numy.Lapack.Vector.new([1,1])
#Vector<size=2, [1.0, 1.0]>
iex(46)> y = Numy.Lapack.Vector.new([4,5])
#Vector<size=2, [4.0, 5.0]>
iex(49)> Numy.Vector.Distance.euclidean(x,y)
5.0 # (4-1)^2 + (5-1)^2 = 9 + 16 = 25

Example

iex(45)> x = Numy.Lapack.Vector.new([1,1])
#Vector<size=2, [1.0, 1.0]>
iex(46)> y = Numy.Lapack.Vector.new([4,5])
#Vector<size=2, [4.0, 5.0]>
iex(47)> Numy.Vector.Distance.manhatten(x,y)
7.0

Pearson's correlation coefficient is the covariance of the two variables divided by the product of their standard deviations.

Link to this section Functions

Example

iex(45)> x = Numy.Lapack.Vector.new([1,1])
#Vector<size=2, [1.0, 1.0]>
iex(46)> y = Numy.Lapack.Vector.new([4,5])
#Vector<size=2, [4.0, 5.0]>
iex(49)> Numy.Vector.Distance.euclidean(x,y)
5.0 # (4-1)^2 + (5-1)^2 = 9 + 16 = 25

Example

iex(45)> x = Numy.Lapack.Vector.new([1,1])
#Vector<size=2, [1.0, 1.0]>
iex(46)> y = Numy.Lapack.Vector.new([4,5])
#Vector<size=2, [4.0, 5.0]>
iex(47)> Numy.Vector.Distance.manhatten(x,y)
7.0

https://en.wikipedia.org/wiki/Minkowski_distance

Pearson's correlation coefficient is the covariance of the two variables divided by the product of their standard deviations.

A value of 1 implies that a linear equation describes the relationship between X and Y perfectly, with all data points lying on a line for which Y increases as X increases. A value of 0 implies that there is no linear correlation between the variables.

Link to this function

root_mean_sq_error(x, y)

View Source