@@ -27,12 +27,17 @@ def pcosine(u, v):
2727
2828 where :math:`u \\ cdot v` is the dot product of :math:`u` and :math:`v`.
2929
30- Args:
31- u (array): Input array.
32- v (array): Input array.
33-
34- Returns:
35- cosine (float): Cosine distance between `u` and `v`.
30+ Parameters
31+ ----------
32+ u : array
33+ Input array.
34+ v : array
35+ Input array.
36+
37+ Returns
38+ -------
39+ cosine : float
40+ Cosine distance between `u` and `v`.
3641
3742 """
3843
@@ -50,26 +55,31 @@ def pdist(X, metric='euclidean', p=2, w=None, V=None, VI=None):
5055
5156 Wraps scipy.spatial.distance.pdist.
5257
53- Args:
54- X (array): An m by n array of m original observations in an
55- n-dimensional space.
56- metric (str, function, optional): The distance metric to use;
57- the distance can be 'braycurtis', 'canberra', 'chebyshev',
58- 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean',
59- 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching',
60- 'minkowski', 'pcosine', 'rogerstanimoto', 'russellrao',
61- 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule'.
62- p (float, optional): The p-norm to apply (for Minkowski, weighted and
63- unweighted).
64- w (array, optional): The weight vector (for weighted Minkowski).
65- V (array, optional): The variance vector (for standardized Euclidean).
66- VI (array, optional): The inverse of the covariance matrix
67- (for Mahalanobis).
68-
69- Returns:
70- Y (array): Returns a condensed distance matrix Y. For each :math:`i`
71- and :math:`j` (where :math:`i<j<n`), the metric
72- ``dist(u=X[i], v=X[j])`` is computed and stored in entry ``ij``.
58+ Parameters
59+ ----------
60+ X : array
61+ An m by n array of m original observations in an n-dimensional space.
62+ metric : str, function, optional
63+ The distance metric to use; the distance can be 'braycurtis',
64+ 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice',
65+ 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis',
66+ 'matching', 'minkowski', 'pcosine', 'rogerstanimoto', 'russellrao',
67+ 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule'.
68+ p : float, optional
69+ The p-norm to apply (for Minkowski, weighted and unweighted).
70+ w : array, optional
71+ The weight vector (for weighted Minkowski).
72+ V : array, optional
73+ The variance vector (for standardized Euclidean).
74+ VI : array, optional
75+ The inverse of the covariance matrix (for Mahalanobis).
76+
77+ Returns
78+ -------
79+ Y : array
80+ Returns a condensed distance matrix Y. For each :math:`i` and
81+ :math:`j` (where :math:`i<j<n`), the metric ``dist(u=X[i], v=X[j])``
82+ is computed and stored in entry ``ij``.
7383
7484 """
7585
@@ -85,29 +95,35 @@ def cdist(XA, XB, metric='euclidean', p=2, V=None, VI=None, w=None):
8595
8696 Wraps scipy.spatial.distance.cdist.
8797
88- Args:
89- XA (array): An :math:`m_A` by :math:`n` array of :math:`m_A` original
90- observations in an :math:`n`-dimensional space.
91- XB (array): An :math:`m_B` by :math:`n` array of :math:`m_B` original
92- observations in an :math:`n`-dimensional space.
93- metric (str, function, optional): The distance metric to use;
94- the distance can be 'braycurtis', 'canberra', 'chebyshev',
95- 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean',
96- 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching',
97- 'minkowski', 'pcosine', 'rogerstanimoto', 'russellrao',
98- 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule'.
99- p (float, optional): The p-norm to apply (for Minkowski, weighted and
100- unweighted).
101- w (array, optional): The weight vector (for weighted Minkowski).
102- V (array, optional): The variance vector (for standardized Euclidean).
103- VI (array, optional): The inverse of the covariance matrix
104- (for Mahalanobis).
105-
106- Returns:
107- Y (array): A :math:`m_A` by :math:`m_B` distance matrix is returned.
108- For each :math:`i` and :math:`j`, the metric
109- ``dist(u=XA[i], v=XB[j])`` is computed and stored in
110- the :math:`ij` th entry.
98+ Parameters
99+ ----------
100+ XA : array
101+ An :math:`m_A` by :math:`n` array of :math:`m_A` original observations
102+ in an :math:`n`-dimensional space.
103+ XB : array
104+ An :math:`m_B` by :math:`n` array of :math:`m_B` original observations
105+ in an :math:`n`-dimensional space.
106+ metric : str, function, optional
107+ The distance metric to use; the distance can be 'braycurtis',
108+ 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice',
109+ 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis',
110+ 'matching', 'minkowski', 'pcosine', 'rogerstanimoto', 'russellrao',
111+ 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule'.
112+ p : float, optional
113+ The p-norm to apply (for Minkowski, weighted and unweighted).
114+ w : array, optional
115+ The weight vector (for weighted Minkowski).
116+ V : array, optional
117+ The variance vector (for standardized Euclidean).
118+ VI : array, optional
119+ The inverse of the covariance matrix (for Mahalanobis).
120+
121+ Returns
122+ -------
123+ Y : array
124+ An :math:`m_A` by :math:`m_B` distance matrix is returned. For each
125+ :math:`i` and :math:`j`, the metric ``dist(u=XA[i], v=XB[j])``
126+ is computed and stored in the :math:`ij` th entry.
111127
112128 """
113129
@@ -124,21 +140,27 @@ def squareform(X, force="no", checks=True):
124140
125141 Wraps scipy.spatial.distance.squareform.
126142
127- Args:
128- X (array): Either a condensed or redundant distance matrix.
129- force (str, optional): As with MATLAB(TM), if force is equal to
130- 'tovector' or 'tomatrix', the input will be treated as a distance
131- matrix or distance vector respectively.
132- checks (bool, optional): If `checks` is set to False, no checks will be
133- made for matrix symmetry nor zero diagonals. This is useful if it
134- is known that ``X - X.T1`` is small and ``diag(X)`` is close to
135- zero. These values are ignored any way so they do not disrupt the
136- squareform transformation.
137-
138- Returns:
139- Y (array): If a condensed distance matrix is passed, a redundant one is
140- returned, or if a redundant one is passed, a condensed distance
141- matrix is returned.
143+ Parameters
144+ ----------
145+ X : array
146+ Either a condensed or redundant distance matrix.
147+ force : str, optional
148+ As with MATLAB(TM), if force is equal to 'tovector' or 'tomatrix', the
149+ input will be treated as a distance matrix or distance vector
150+ respectively.
151+ checks : bool, optional
152+ If `checks` is set to False, no checks will be made for matrix
153+ symmetry nor zero diagonals. This is useful if it is known that
154+ ``X - X.T1`` is small and ``diag(X)`` is close to zero. These values
155+ are ignored any way so they do not disrupt the squareform
156+ transformation.
157+
158+ Returns
159+ -------
160+ Y : array
161+ If a condensed distance matrix is passed, a redundant one is returned,
162+ or if a redundant one is passed, a condensed distance matrix is
163+ returned.
142164
143165 """
144166
0 commit comments