pm4py.algo.evaluation.earth_mover_distance.variants package#
PM4Py – A Process Mining Library for Python
Copyright (C) 2024 Process Intelligence Solutions UG (haftungsbeschränkt)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see this software project’s root or visit <https://www.gnu.org/licenses/>.
Website: https://processintelligence.solutions Contact: info@processintelligence.solutions
Submodules#
pm4py.algo.evaluation.earth_mover_distance.variants.pyemd module#
PM4Py – A Process Mining Library for Python
Copyright (C) 2024 Process Intelligence Solutions UG (haftungsbeschränkt)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see this software project’s root or visit <https://www.gnu.org/licenses/>.
Website: https://processintelligence.solutions Contact: info@processintelligence.solutions
- 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_histogramnp.ndarray
The first distribution (array of nonnegative numbers).
- second_histogramnp.ndarray
The second distribution (array of nonnegative numbers).
- distance_matrixnp.ndarray
Matrix of distances between points of the two distributions.
Returns#
- float
The computed EMD value.
- 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_histogramnp.ndarray
The first distribution (array of nonnegative numbers).
- second_histogramnp.ndarray
The second distribution (array of nonnegative numbers).
- distance_matrixnp.ndarray
Matrix of distances between points of the two distributions.
Returns#
- float
The computed EMD value.
- pm4py.algo.evaluation.earth_mover_distance.variants.pyemd.apply(lang1: Dict[List[str], float], lang2: Dict[List[str], float], parameters: Dict[str | Parameters, Any] | None = None) float[source]#