Skip to main content
Rust4PM

alignments

process_mining::conformance::case_centric::alignments

Related Examples(1)

Functions in this Module(4)

compute_fitness

conformance::case_centric::alignmentsSource
Compute fitness stats from alignment results
Also constructs the empty-trace alignment (shortest path through model)
PetriNetrequiredA Petri net of [`Place`]s and [`Transition`]s
AlignmentOptionsOptions for computing alignment
import r4pm

align_res = [
    {
        "activities": ['example'],
        "frequency": 1,
        "result": {
            "Ok": {
                "cost": 1,
                "moves": [
                    {
                        "SyncMove": {
                            "trace_event_index": 1,
                            "transition": 'example',
                        },
                    },
                ],
                "states_visited": 1,
            },
        },
    },
]
net = {
    "arcs": [
        {
            "from_to": {"nodes": ['example', 'example'], "type": 'PlaceTransition'},
            "weight": 1,
        },
    ],
    "places": {"something": {"id": '893f8ab9'}},
    "transitions": {"something": {"id": '893f8ab9'}},
}
# Optional argument: options, can also be omitted
options = {
    "cost_fn": {
        "log_move_cost": 1,
        "model_move_cost": 1,
        "silent_move_cost": 1,
        "sync_move_cost": 1,
    },
}
res = r4pm.bindings.compute_fitness(align_res, net, options)

process_mining/src/conformance/case_centric/alignments/mod.rs:204

align_empty_trace

conformance::case_centric::alignmentsSource
Align the empty trace to the given model
with the specified options
Permits at most 255 (petri_net::TokenCount::MAX) tokens in each place.
PetriNetrequiredA Petri net of [`Place`]s and [`Transition`]s
AlignmentOptionsOptions for computing alignment
import r4pm

net = {
    "arcs": [
        {
            "from_to": {"nodes": ['example', 'example'], "type": 'PlaceTransition'},
            "weight": 1,
        },
    ],
    "places": {"something": {"id": '893f8ab9'}},
    "transitions": {"something": {"id": '893f8ab9'}},
}
# Optional argument: options, can also be omitted
options = {
    "cost_fn": {
        "log_move_cost": 1,
        "model_move_cost": 1,
        "silent_move_cost": 1,
        "sync_move_cost": 1,
    },
}
res = r4pm.bindings.align_empty_trace(net, options)

process_mining/src/conformance/case_centric/alignments/mod.rs:174

align_trace

conformance::case_centric::alignmentsSource
Compute alignment for a single trace (given as activity sequence).
Permits at most 255 (petri_net::TokenCount::MAX) tokens in each place.
PetriNetrequiredA Petri net of [`Place`]s and [`Transition`]s
Vec<String>required
AlignmentOptionsOptions for computing alignment
import r4pm

net = {
    "arcs": [
        {
            "from_to": {"nodes": ['example', 'example'], "type": 'PlaceTransition'},
            "weight": 1,
        },
    ],
    "places": {"something": {"id": '893f8ab9'}},
    "transitions": {"something": {"id": '893f8ab9'}},
}
# Optional argument: options, can also be omitted
options = {
    "cost_fn": {
        "log_move_cost": 1,
        "model_move_cost": 1,
        "silent_move_cost": 1,
        "sync_move_cost": 1,
    },
}
res = r4pm.bindings.align_trace(net, ['example'], options)

process_mining/src/conformance/case_centric/alignments/mod.rs:160

align_variants

conformance::case_centric::alignmentsSource
Compute alignments for all variants from a pre-computed activity projection.
Permits at most 255 (petri_net::TokenCount::MAX) tokens in each place.
PetriNetrequiredA Petri net of [`Place`]s and [`Transition`]s
EventLogActivityProjectionrequired
AlignmentOptionsOptions for computing alignment
import r4pm

net = {
    "arcs": [
        {
            "from_to": {"nodes": ['example', 'example'], "type": 'PlaceTransition'},
            "weight": 1,
        },
    ],
    "places": {"something": {"id": '893f8ab9'}},
    "transitions": {"something": {"id": '893f8ab9'}},
}
# Also: .json, .xes.gz
projection = r4pm.import_item('EventLogActivityProjection', 'log.xes')
# Optional argument: options, can also be omitted
options = {
    "cost_fn": {
        "log_move_cost": 1,
        "model_move_cost": 1,
        "silent_move_cost": 1,
        "sync_move_cost": 1,
    },
}
res = r4pm.bindings.align_variants(net, projection, options)

process_mining/src/conformance/case_centric/alignments/mod.rs:101