opfython.math.distance

Distance-based metrics.

opfython.math.distance.DISTANCES
opfython.math.distance.additive_symmetric_distance(x: numpy.array, y: numpy.array)

Calculates the Additive Symmetric Distance (Symmetric Divergence).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Additive Symmetric Distance between x and y.

Return type

(float)

opfython.math.distance.average_euclidean_distance(x: numpy.array, y: numpy.array)

Calculates the Average Euclidean Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Average Euclidean Distance between x and y.

Return type

(float)

opfython.math.distance.bhattacharyya_distance(x: numpy.array, y: numpy.array)

Calculates the Bhattacharyya Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Bhattacharyya Distance between x and y.

Return type

(float)

opfython.math.distance.bray_curtis_distance(x: numpy.array, y: numpy.array)

Calculates the Bray-Curtis Distance (Sorensen Distance).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Bray-Curtis Distance between x and y.

Return type

(float)

opfython.math.distance.canberra_distance(x: numpy.array, y: numpy.array)

Calculates the Canberra Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Canberra Distance between x and y.

Return type

(float)

opfython.math.distance.chebyshev_distance(x: numpy.array, y: numpy.array)

Calculates the Chebyshev Distance (Maximum Value Distance, Lagrange, Chessboard Distance).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Chebyshev Distance between x and y.

Return type

(float)

opfython.math.distance.chi_squared_distance(x: numpy.array, y: numpy.array)

Calculates the Chi-Squared Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Chi-Squared Distance between x and y.

Return type

(float)

opfython.math.distance.chord_distance(x: numpy.array, y: numpy.array)

Calculates the Chord Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Chord Distance between x and y.

Return type

(float)

opfython.math.distance.clark_distance(x: numpy.array, y: numpy.array)

Calculates the Clark Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Clark Distance between x and y.

Return type

(float)

opfython.math.distance.cosine_distance(x: numpy.array, y: numpy.array)

Calculates the Cosine Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The cosine Distance between x and y.

Return type

(float)

opfython.math.distance.dice_distance(x: numpy.array, y: numpy.array)

Calculates the Dice Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Dice Distance between x and y.

Return type

(float)

opfython.math.distance.divergence_distance(x: numpy.array, y: numpy.array)

Calculates the Divergence Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Divergence Distance between x and y.

Return type

(float)

opfython.math.distance.euclidean_distance(x: numpy.array, y: numpy.array)

Calculates the Euclidean Distance (L2 Norm, Ruler Distance).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Euclidean Distance between x and y.

Return type

(float)

opfython.math.distance.gaussian_distance(x, y, gamma=1)

Calculates the Gaussian Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Gaussian Distance between x and y.

Return type

(float)

opfython.math.distance.gower_distance(x: numpy.array, y: numpy.array)

Calculates the Gower Distance (Average Manhattan, Mean Character Distance).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Gower Distance between x and y.

Return type

(float)

opfython.math.distance.hamming_distance(x: numpy.array, y: numpy.array)

Calculates the Hamming Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Hamming Distance between x and y.

Return type

(float)

opfython.math.distance.hassanat_distance(x: numpy.array, y: numpy.array)

Calculates the Hassanat Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Hassanat Distance between x and y.

Return type

(float)

opfython.math.distance.hellinger_distance(x: numpy.array, y: numpy.array)

Calculates the Hellinger Distance (Jeffries-Matusita Distance).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Hellinger Distance between x and y.

Return type

(float)

opfython.math.distance.jaccard_distance(x: numpy.array, y: numpy.array)

Calculates the Jaccard Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Jaccard Distance between x and y.

Return type

(float)

opfython.math.distance.jeffreys_distance(x: numpy.array, y: numpy.array)

Calculates the Jeffreys Distance (J-Divergence, KL2 Divergence).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Jeffreys Distance between x and y.

Return type

(float)

opfython.math.distance.jensen_distance(x: numpy.array, y: numpy.array)

Calculates the Jensen Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Jensen Distance between x and y.

Return type

(float)

opfython.math.distance.jensen_shannon_distance(x: numpy.array, y: numpy.array)

Calculates the Jensen-Shannon Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Jensen-Shannon Distance between x and y.

Return type

(float)

opfython.math.distance.k_divergence_distance(x: numpy.array, y: numpy.array)

Calculates the K Divergence Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The K Divergence Distance between x and y.

Return type

(float)

opfython.math.distance.kulczynski_distance(x: numpy.array, y: numpy.array)

Calculates the Kulczynski Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Kulczynski Distance between x and y.

Return type

(float)

opfython.math.distance.kullback_leibler_distance(x: numpy.array, y: numpy.array)

Calculates the Kullback-Leibler Distance (KL Divergence).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Kullback-Leibler Distance between x and y.

Return type

(float)

opfython.math.distance.log_euclidean_distance(x: numpy.array, y: numpy.array)

Calculates the log-Euclidean Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The log-Euclidean Distance between x and y.

Return type

(float)

opfython.math.distance.log_squared_euclidean_distance(x: numpy.array, y: numpy.array)

Calculates the log-Squared Euclidean Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Log Squared Euclidean Distance between x and y.

Return type

(float)

opfython.math.distance.lorentzian_distance(x: numpy.array, y: numpy.array)

Calculates the Lorentzian Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Lorentzian Distance between x and y.

Return type

(float)

opfython.math.distance.manhattan_distance(x: numpy.array, y: numpy.array)

Calculates the Manhattan Distance (L1 Norm, Taxicab Norm, City Block Distance).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Manhattan Distance between x and y.

Return type

(float)

opfython.math.distance.matusita_distance(x: numpy.array, y: numpy.array)

Calculates the Matusita Distance, where features must be positive.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Matusita Distance between x and y.

Return type

(float)

opfython.math.distance.max_symmetric_distance(x: numpy.array, y: numpy.array)

Calculates the Max Symmetric Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Max Symmetric Distance between x and y.

Return type

(float)

opfython.math.distance.mean_censored_euclidean_distance(x: numpy.array, y: numpy.array)

Calculates the Mean Censored Euclidean Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Mean Censored Euclidean Distance between x and y.

Return type

(float)

opfython.math.distance.min_symmetric_distance(x: numpy.array, y: numpy.array)

Calculates the Min Symmetric Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Min Symmetric Distance between x and y.

Return type

(float)

opfython.math.distance.neyman_distance(x: numpy.array, y: numpy.array)

Calculates the Neyman Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Neyman Distance between x and y.

Return type

(float)

opfython.math.distance.non_intersection_distance(x: numpy.array, y: numpy.array)

Calculates the Non-Intersection Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Non-Intersection Distance between x and y.

Return type

(float)

opfython.math.distance.pearson_distance(x: numpy.array, y: numpy.array)

Calculates the Pearson Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Pearson Distance between x and y.

Return type

(float)

opfython.math.distance.sangvi_distance(x: numpy.array, y: numpy.array)

Calculates the Sangvi Distance (Probabilistic Symmetric).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Sangvi Distance between x and y.

Return type

(float)

opfython.math.distance.soergel_distance(x: numpy.array, y: numpy.array)

Calculates the Soergel Distance (Ruzicka Distance).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Soergel Distance between x and y.

Return type

(float)

opfython.math.distance.squared_chord_distance(x: numpy.array, y: numpy.array)

Calculates the Squared Chord Distance, where features must be positive.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Squared Chord Distance between x and y.

Return type

(float)

opfython.math.distance.squared_distance(x: numpy.array, y: numpy.array)

Calculates the Squared Distance (Triangular Discrimination Distance).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Squared Distance between x and y.

Return type

(float)

opfython.math.distance.squared_euclidean_distance(x: numpy.array, y: numpy.array)

Calculates the Squared Euclidean Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Squared Euclidean Distance between x and y.

Return type

(float)

opfython.math.distance.statistic_distance(x: numpy.array, y: numpy.array)

Calculates the Statistic Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Statistic Distance between x and y.

Return type

(float)

opfython.math.distance.topsoe_distance(x: numpy.array, y: numpy.array)

Calculates the Topsoe Distance (Information Statistics).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Topsoe Distance between x and y.

Return type

(float)

opfython.math.distance.vicis_symmetric1_distance(x: numpy.array, y: numpy.array)

Calculates the Vicis Symmetric 1 Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Vicis Symmetric 1 Distance between x and y.

Return type

(float)

opfython.math.distance.vicis_symmetric2_distance(x: numpy.array, y: numpy.array)

Calculates the Vicis Symmetric 2 Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Vicis Symmetric 2 Distance between x and y.

Return type

(float)

opfython.math.distance.vicis_symmetric3_distance(x: numpy.array, y: numpy.array)

Calculates the Vicis Symmetric 3 Distance.

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Vicis Symmetric 3 Distance between x and y.

Return type

(float)

opfython.math.distance.vicis_wave_hedges_distance(x: numpy.array, y: numpy.array)

Calculates the Vicis-Wave Hedges Distance (Wave-Hedges).

Parameters
  • x – N-dimensional array.

  • y – N-dimensional array.

Returns

The Vicis-Wave Hedges Distance between x and y.

Return type

(float)