pm4py.algo.evaluation.earth_mover_distance.variants.pyemd module#
- class pm4py.algo.evaluation.earth_mover_distance.variants.pyemd.Parameters[source]#
Bases:
object- STRING_DISTANCE = 'string_distance'#
- USE_FAST_EMD = 'use_fast_emd'#
- pm4py.algo.evaluation.earth_mover_distance.variants.pyemd.get_act_correspondence(activities, parameters=None)[source]#
- pm4py.algo.evaluation.earth_mover_distance.variants.pyemd.encode_two_languages(lang1, lang2, parameters=None)[source]#
- class pm4py.algo.evaluation.earth_mover_distance.variants.pyemd.EMDCalculator[source]#
Bases:
objectA class that provides an EMD (Earth Mover’s Distance) computation similar to what pyemd offers. It uses linear programming via scipy.optimize.linprog to solve the underlying flow problem.
Usage:#
emd_value = EMDCalculator.emd(first_histogram, second_histogram, distance_matrix)
- static emd(first_histogram: ndarray, second_histogram: ndarray, distance_matrix: ndarray) float[source]#
Compute the Earth Mover’s Distance given two histograms and a distance matrix.
- Parameters:
first_histogram (np.ndarray) – The first distribution (array of nonnegative numbers).
second_histogram (np.ndarray) – The second distribution (array of nonnegative numbers).
distance_matrix (np.ndarray) – Matrix of distances between points of the two distributions.
- Returns:
The computed EMD value.
- Return type:
- class pm4py.algo.evaluation.earth_mover_distance.variants.pyemd.POTEMDCalculator[source]#
Bases:
objectA faster implementation of EMD using the POT (Python Optimal Transport) library. Falls back to the SciPy implementation if POT is not available.
Usage:#
emd_value = POTEMDCalculator.emd(first_histogram, second_histogram, distance_matrix)
- static emd(first_histogram: ndarray, second_histogram: ndarray, distance_matrix: ndarray) float[source]#
Compute the Earth Mover’s Distance using POT if available, otherwise fall back to SciPy.
- Parameters:
first_histogram (np.ndarray) – The first distribution (array of nonnegative numbers).
second_histogram (np.ndarray) – The second distribution (array of nonnegative numbers).
distance_matrix (np.ndarray) – Matrix of distances between points of the two distributions.
- Returns:
The computed EMD value.
- Return type: