scipy.spatial.distance.
sokalsneath#
- scipy.spatial.distance.sokalsneath(u, v, w=None)[Quelle]#
Berechnet die Sokal-Sneath-Unähnlichkeit zwischen zwei booleschen 1D-Arrays.
Die Sokal-Sneath-Unähnlichkeit zwischen u und v,
\[\frac{R} {c_{TT} + R}\]wobei \(c_{ij}\) die Anzahl der Vorkommen von \(\mathtt{u[k]} = i\) und \(\mathtt{v[k]} = j\) für \(k < n\) ist und \(R = 2(c_{TF} + c_{FT})\).
- Parameter:
- u(N,) array_like, bool
Eingabearray.
- v(N,) array_like, bool
Eingabearray.
- w(N,) array_like, optional
Die Gewichte für jeden Wert in u und v. Standard ist None, was jedem Wert ein Gewicht von 1,0 gibt.
- Rückgabe:
- sokalsneathdouble
Die Sokal-Sneath-Unähnlichkeit zwischen den Vektoren u und v.
Beispiele
>>> from scipy.spatial import distance >>> distance.sokalsneath([1, 0, 0], [0, 1, 0]) 1.0 >>> distance.sokalsneath([1, 0, 0], [1, 1, 0]) 0.66666666666666663 >>> distance.sokalsneath([1, 0, 0], [2, 1, 0]) 0.0 >>> distance.sokalsneath([1, 0, 0], [3, 1, 0]) -2.0