# Distance

Various methods are available to calculate the distance between two datasets:

- Cosine Distance
- Cosine Similarity
- Euclidian Distance
- Nan Euclidean Distance
- Squared Euclidean
- Manhattan Distance
- Minkowski Distance

Various methods are available to calculate the distance between two datasets:

- Cosine Distance
- Cosine Similarity
- Euclidian Distance
- Nan Euclidean Distance
- Squared Euclidean
- Manhattan Distance
- Minkowski Distance

**cosinedistance**

It computes Cosine Distance between two vectors or matrices of same length. If one of the inputs has one row and the other has 'm' rows, then similarity is computed between one row and every other row.**cosinesimilarity**

It computes Cosine Similarity between two vectors or matrices of same length. If one of the inputs has one row and the other has 'm' rows, then similarity is computed between one row and every other row. The results of similarity range from -1 to 1 where -1 means both vectors are exactly opposite, 1 represents exactly the same and intermediate represents the similarity or dissimilarity and zero represents the orthogonality.**euclideandistance**

It computes Euclidean distance between two vectors or matrices of same length. If one of the inputs has one row and the other has 'm' rows, then distance is computed between one row and every other row. The more the distance is, the less similar the data points are.**manhattandistance**

It computes Manhattan distance between two vectors or matrices of same length. If one of the inputs has one row and the other has 'm' rows, then distance is computed between one row and every other row. The more the distance is, the less similar the data points are.**minkowskidistance**

It computes Lp Norm between two vectors or matrices of same length. If one of the inputs has one row and the other has 'm' rows, then distance is computed between one row and every other row. If p = 1, it becomes Manhattan distance. If p = 2, it becomes Euclidean distance. If p = n, then it becomes Ln Norm. It is a generalized formula for computing distances based on p value.**naneuclideandistance**

It computes Euclidean distance between two vectors or matrices even if some of the coordinates/columns are missing. If one of the inputs has one row and the other has â€˜mâ€™ rows, then distance is computed between one row and every other row. It is similar to Euclidean Distance except the fact that this works even if some of the values are missing.**squaredeuclideandistance**

It computes Squared Euclidean distance between two vectors or matrices of same length. If one of the inputs has one row and the other has 'm' rows, then distance is computed between one row and every other row. The more the distance is, the less similar the data points are.