728x90

Variant란, 하나의 유니크한 프로세스의 진행 경로를 말한다. 예를 들어, <a,b,c,d>가 10번, <a,c,b,d>가 5번 일어난 이벤트 로그가 있다고 하자. 그렇다면 이 이벤트 로그의 variant는 <a,b,c,d>, <a,c,b,d>의 두 개가 된다. 이번 포스팅에서는 PM4Py를 이용하여 variant를 기준으로 이벤트 로그를 필터링하는 방법에 대해 알아보겠다. 

 

1. 우선, xes 파일을 import하여 이를 log에 저장해 준다.

import os
from pm4py.objects.log.importer.xes import factory as xes_importer

log = xes_importer.import_log(os.path.join("input_data","receipt.xes")) #괄호 안에 원하는 파일의 경로를 쓴다

 

2. 어떤 variant를 필터링할 것인지를 결정하기 위해 이벤트 로그가 어떤 variant로 구성되어 있는지를 파악한다.

from pm4py.algo.filtering.log.variants import variants_filter

variants = variants_filter.get_variants(log)
print(variants.keys())

이 variants는 variant를 key 값으로 가지고 그 variant에 해당하는 케이스 정보들을 value 값으로 가지는 dictionary이다. 그래서 어떤 variant가 있는지를 파악하기 위해 variants의 key 값을 출력했다. 다음과 같은 결과가 나오면 성공이다.

dict_keys(['Confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T10 Determine necessity to stop indication,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T16 Report reasons to hold request,T17 Check report Y to stop indication,T19 Determine report Y to stop indication,T20 Print report Y to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T10 Determine necessity to stop indication,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T11 Create document X request unlicensed,T12 Check document X request unlicensed,T14 Determine document X request unlicensed,T15 Print document X request unlicensed', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T08 Draft and send request for advice,T09-1 Process or receive external advice from party 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T11 Create document X request unlicensed', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T04 Determine confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T10 Determine necessity to stop indication,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T16 Report reasons to hold request,T17 Check report Y to stop indication,T19 Determine report Y to stop indication,T20 Print report Y to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T05 Print and send confirmation of receipt,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T16 Report reasons to hold request,T17 Check report Y to stop indication,T19 Determine report Y to stop indication,T20 Print report Y to stop indication,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T10 Determine necessity to stop indication,T16 Report reasons to hold request,T17 Check report Y to stop indication,T19 Determine report Y to stop indication,T20 Print report Y to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T08 Draft and send request for advice,T07-5 Draft intern advice aspect 5,T09-4 Process or receive external advice from party 4,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-3 Draft intern advice hold for aspect 3,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T07-1 Draft intern advice aspect 1,T08 Draft and send request for advice,T09-1 Process or receive external advice from party 1,T07-3 Draft intern advice hold for aspect 3,T07-4 Draft internal advice to hold for type 4,T07-2 Draft intern advice aspect 2,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T11 Create document X request unlicensed,T12 Check document X request unlicensed,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T13 Adjust document X request unlicensed', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T07-5 Draft intern advice aspect 5', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T06 Determine necessity of stop advice,T06 Determine necessity of stop advice,T07-4 Draft internal advice to hold for type 4,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T04 Determine confirmation of receipt,T10 Determine necessity to stop indication,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T03 Adjust confirmation of receipt,T06 Determine necessity of stop advice', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T08 Draft and send request for advice,T09-4 Process or receive external advice from party 4,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T11 Create document X request unlicensed,T12 Check document X request unlicensed,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T13 Adjust document X request unlicensed,T12 Check document X request unlicensed,T14 Determine document X request unlicensed,T15 Print document X request unlicensed', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T05 Print and send confirmation of receipt,T11 Create document X request unlicensed,T12 Check document X request unlicensed,T14 Determine document X request unlicensed,T15 Print document X request unlicensed', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T16 Report reasons to hold request,T17 Check report Y to stop indication,T19 Determine report Y to stop indication,T20 Print report Y to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T08 Draft and send request for advice,T09-1 Process or receive external advice from party 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T07-4 Draft internal advice to hold for type 4,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T16 Report reasons to hold request,T17 Check report Y to stop indication,T19 Determine report Y to stop indication,T20 Print report Y to stop indication,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T11 Create document X request unlicensed,T12 Check document X request unlicensed,T14 Determine document X request unlicensed,T15 Print document X request unlicensed', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T08 Draft and send request for advice,T09-3 Process or receive external advice from party 3,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-3 Draft intern advice hold for aspect 3,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T07-3 Draft intern advice hold for aspect 3,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T07-3 Draft intern advice hold for aspect 3,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T05 Print and send confirmation of receipt,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T05 Print and send confirmation of receipt,T11 Create document X request unlicensed', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T05 Print and send confirmation of receipt,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T08 Draft and send request for advice,T09-1 Process or receive external advice from party 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T11 Create document X request unlicensed', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T11 Create document X request unlicensed,T12 Check document X request unlicensed,T04 Determine confirmation of receipt,T14 Determine document X request unlicensed,T05 Print and send confirmation of receipt,T15 Print document X request unlicensed', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T08 Draft and send request for advice,T09-4 Process or receive external advice from party 4,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T02 Check confirmation of receipt,T07-2 Draft intern advice aspect 2', 'Confirmation of receipt,T06 Determine necessity of stop advice,T08 Draft and send request for advice,T07-1 Draft intern advice aspect 1,T07-2 Draft intern advice aspect 2,T09-1 Process or receive external advice from party 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T10 Determine necessity to stop indication,T11 Create document X request unlicensed,T12 Check document X request unlicensed,T14 Determine document X request unlicensed,T15 Print document X request unlicensed', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T11 Create document X request unlicensed,T12 Check document X request unlicensed,T14 Determine document X request unlicensed,T15 Print document X request unlicensed', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T16 Report reasons to hold request,T17 Check report Y to stop indication,T18 Adjust report Y to stop indicition,T17 Check report Y to stop indication,T18 Adjust report Y to stop indicition,T17 Check report Y to stop indication,T18 Adjust report Y to stop indicition,T17 Check report Y to stop indication,T18 Adjust report Y to stop indicition,T17 Check report Y to stop indication,T19 Determine report Y to stop indication,T20 Print report Y to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T08 Draft and send request for advice,T09-1 Process or receive external advice from party 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T03 Adjust confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T07-5 Draft intern advice aspect 5,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T08 Draft and send request for advice,T09-4 Process or receive external advice from party 4,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T10 Determine necessity to stop indication,T11 Create document X request unlicensed,T12 Check document X request unlicensed,T14 Determine document X request unlicensed,T15 Print document X request unlicensed', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T16 Report reasons to hold request,T17 Check report Y to stop indication,T19 Determine report Y to stop indication,T20 Print report Y to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T16 Report reasons to hold request,T17 Check report Y to stop indication,T18 Adjust report Y to stop indicition,T17 Check report Y to stop indication,T18 Adjust report Y to stop indicition,T17 Check report Y to stop indication,T19 Determine report Y to stop indication,T20 Print report Y to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T06 Determine necessity of stop advice,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T04 Determine confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T08 Draft and send request for advice,T09-3 Process or receive external advice from party 3,T09-1 Process or receive external advice from party 1,T07-3 Draft intern advice hold for aspect 3,T07-5 Draft intern advice aspect 5,T09-2 Process or receive external advice from party 2,T09-4 Process or receive external advice from party 4,T07-2 Draft intern advice aspect 2,T07-1 Draft intern advice aspect 1,T07-4 Draft internal advice to hold for type 4,T06 Determine necessity of stop advice,T06 Determine necessity of stop advice,T06 Determine necessity of stop advice', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T04 Determine confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T10 Determine necessity to stop indication,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T07-1 Draft intern advice aspect 1,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T07-1 Draft intern advice aspect 1,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T11 Create document X request unlicensed,T12 Check document X request unlicensed,T14 Determine document X request unlicensed,T15 Print document X request unlicensed', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-3 Draft intern advice hold for aspect 3,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T07-3 Draft intern advice hold for aspect 3,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T07-5 Draft intern advice aspect 5,T08 Draft and send request for advice,T09-3 Process or receive external advice from party 3,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T08 Draft and send request for advice,T09-3 Process or receive external advice from party 3,T04 Determine confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T08 Draft and send request for advice,T09-3 Process or receive external advice from party 3,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T07-2 Draft intern advice aspect 2,T08 Draft and send request for advice,T09-3 Process or receive external advice from party 3,T06 Determine necessity of stop advice,T08 Draft and send request for advice,T09-3 Process or receive external advice from party 3,T07-2 Draft intern advice aspect 2,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T11 Create document X request unlicensed,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T12 Check document X request unlicensed,T14 Determine document X request unlicensed,T15 Print document X request unlicensed', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T08 Draft and send request for advice,T09-3 Process or receive external advice from party 3,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T06 Determine necessity of stop advice,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T10 Determine necessity to stop indication,T05 Print and send confirmation of receipt,T11 Create document X request unlicensed,T12 Check document X request unlicensed,T14 Determine document X request unlicensed,T15 Print document X request unlicensed', 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt', 'Confirmation of receipt,T06 Determine necessity of stop advice,T07-4 Draft internal advice to hold for type 4,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T07-4 Draft internal advice to hold for type 4,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T06 Determine necessity of stop advice,T05 Print and send confirmation of receipt,T10 Determine necessity to stop indication,T11 Create document X request unlicensed,T12 Check document X request unlicensed,T14 Determine document X request unlicensed,T15 Print document X request unlicensed', 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T04 Determine confirmation of receipt,T03 Adjust confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt'])

 

 각 variant의 빈도수를 파악하고 싶다면 다음 코드를 입력한다.

from pm4py.statistics.traces.log import case_statistics

variants_count = case_statistics.get_variant_statistics(log)
variants_count = sorted(variants_count, key=lambda x: x['count'], reverse=True)
print(variants_count)

다음과 같은 결과가 나오면 성공이다.

[{'variant': 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'count': 713}, {'variant': 'Confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'count': 123}, {'variant': 'Confirmation of receipt', 'count': 116}, {'variant': 'Confirmation of receipt,T02 Check confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt', 'count': 115}, ...

3. 원하는 variant만을 남기고 나머지를 필터링한다.

apply의 두 번째 인수로 원하는 variant를 list로 넣어준다.

filtered_log1 = variants_filter.apply(log, ["Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication"])

잘 필터링되었는지 확인하기 위해 filtered_log1의 variant가 무엇이 있는지를 2번에서 쓴 것과 같은 방법으로 확인해본다.

variants_count_filtered_log1 = case_statistics.get_variant_statistics(filtered_log1)
print(variants_count_filtered_log1)

다음과 같은 결과가 나오는 것을 확인함으로써 필터링이 잘 되었음을 알 수 있다.

[{'variant': 'Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication', 'count': 713}]

만약 해당 variant만을 제거하는 필터링을 하고 싶다면 다른 필터들과 마찬가지로 아래 코드와 같이 parameter의 positive 값을 False로 전달해주면 된다.

filtered_log2 = variants_filter.apply(log, ["Confirmation of receipt,T02 Check confirmation of receipt,T04 Determine confirmation of receipt,T05 Print and send confirmation of receipt,T06 Determine necessity of stop advice,T10 Determine necessity to stop indication"], parameters={"positive": False})

4. 자동 필터링을 원한다면, 다음 코드를 통해 필터링한다. 

자동 필터링의 식은 시작/끝 액티비티를 필터링할 때와 같다. 다음 포스팅의 4번 윗 부분을 참고한다.

2019/09/11 - [Process Mining - Tools/pm4py] - PM4Py 로그 필터링하는 법 (시작/끝 액티비티 기준 필터링)

 

PM4Py 로그 필터링하는 법 (시작/끝 액티비티 기준 필터링)

PM4Py는 다양한 로그 필터링 방법들을 제공한다. 이번 포스팅에서는 PM4Py를 이용하여 이벤트 로그 trace의 시작/끝 액티비티를 기준으로 이벤트 로그를 필터링하는 방법에 대해 알아보겠다. 1. 우선, xes 파일을..

process-mining.tistory.com

auto_filtered_log = variants_filter.apply_auto_filter(log)

 

이번 포스팅에서는 variant를 기준으로 이벤트 로그를 필터링하는 방법에 대해 알아보았다.

300x250
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기