Closed bwanaaa closed 4 years ago
Dear bwanaaa,
The same parameters that you use for the conversion
parameters={constants.PARAMETER_CONSTANT_CASEID_KEY: "Case ID", constants.PARAMETER_CONSTANT_ACTIVITY_KEY: "Activity", constants.PARAMETER_CONSTANT_TIMESTAMP_KEY: "dd-MM-yyyy"}
Should also be used with the Alpha Miner
Thank you. For anyone else as dense as me, I got it to work with this code:
from pm4py.objects.log.adapters.pandas import csv_import_adapter from pm4py.objects.conversion.log import factory as conversion_factory from pm4py.util import constants from pm4py.algo.discovery.alpha import factory as alpha_miner from pm4py.visualization.petrinet import factory as vis_factory
dataframe = csv_import_adapter.import_dataframe_from_path("running-example.csv") parameters1={constants.PARAMETER_CONSTANT_CASEID_KEY: "Case ID", constants.PARAMETER_CONSTANT_ACTIVITY_KEY: "Activity", constants.PARAMETER_CONSTANT_TIMESTAMP_KEY: "dd-MM-yyyy"}
log = conversion_factory.apply(dataframe, parameters=parameters1) net, initial_marking, final_marking = alpha_miner.apply(log,parameters=parameters1) gviz = vis_factory.apply(net, initial_marking, final_marking) vis_factory.view(gviz)
Windows 10 pro, anaconda latest I successfully installed pm4py (as well as graphviz) and got it to work with a sample xes file. However, when using a csv or xls file, the created log has an unusual entry .The first few lines of the csv file I used look like this:
This code successfully creates the log file:
However the next line
net, initial_marking, final_marking = alpha_miner.apply(log)
gives this error>
Where does it get this key? I never specified it nor was it in the csv file. I tried to save the log file in xes format and reimport it as xes but that fails as well (since the key names for xes are hard coded)