{ "cells": [ { "metadata": { "ExecuteTime": { "end_time": "2026-05-29T14:06:21.624671300Z", "start_time": "2026-05-29T14:06:21.609661100Z" } }, "cell_type": "code", "source": [ "import warnings\n", "warnings.filterwarnings(\"ignore\", category=UserWarning)" ], "id": "940545f4d82e065d", "outputs": [], "execution_count": 1 }, { "cell_type": "markdown", "id": "5279e90c", "metadata": {}, "source": [ "# Conformance Checking with a DECLARE model\n", "\n", "This tutorial explains how to perform the conformance checking of a DECLARE model and how to browse the results. We start by importing the classes for managing with DECLARE models: `DeclareModel` and `DeclareModelTemplate`:" ] }, { "cell_type": "code", "id": "deea27bb", "metadata": { "ExecuteTime": { "end_time": "2026-05-29T14:06:23.305029200Z", "start_time": "2026-05-29T14:06:21.630954800Z" } }, "source": [ "import os\n", "\n", "from Declare4Py.ProcessModels.DeclareModel import DeclareModel" ], "outputs": [], "execution_count": 2 }, { "cell_type": "markdown", "id": "6f2f5b6f", "metadata": {}, "source": [ "The next step is the parsing of the log and of the DECLARE model." ] }, { "cell_type": "code", "id": "cefcfbac", "metadata": { "ExecuteTime": { "end_time": "2026-05-29T14:06:24.523911100Z", "start_time": "2026-05-29T14:06:23.335319300Z" } }, "source": [ "from Declare4Py.D4PyEventLog import D4PyEventLog\n", "\n", "log_path = os.path.join(\"../../../\", \"tests\", \"test_logs\",\"Sepsis Cases.xes.gz\")\n", "event_log = D4PyEventLog(case_name=\"case:concept:name\")\n", "event_log.parse_xes_log(log_path)\n", "\n", "model_path = os.path.join(\"../../../\", \"tests\", \"test_models\",\"data_model.decl\")\n", "declare_model = DeclareModel().parse_from_file(model_path)" ], "outputs": [ { "data": { "text/plain": [ "parsing log, completed traces :: 0%| | 0/1050 [00:00= 45) AND (A.InfectionSuspected is true) AND (A.DiagnosticLacticAcid is true) AND (A.DiagnosticSputum is true) AND (A.Hypoxie is false) AND (A.DiagnosticUrinaryCulture is true) AND (A.DiagnosticLiquor is false) AND (A.SIRSCritTemperature is true) AND (A.Infusion is true) AND (A.Hypotensie is false) AND (A.DiagnosticUrinarySediment is true) AND (A.Oligurie is false) AND (A.Age <= 80) AND (A.SIRSCritTachypnea is true) AND (A.DiagnosticOther is false) AND (A.SIRSCritLeucos is false) AND (A.DiagnosticIC is true) AND (A.SIRSCriteria2OrMore is true) AND (A.DiagnosticXthorax is true) |T.org:group is C |52,2154,s\n", "5 Chain Precedence[Release A, Return ER] |A.org:group is ? |T.org:group is E |1121801,1121801,s\n", "6 Chain Precedence[ER Sepsis Triage, IV Antibiotics] |A.org:group is L |T.org:group is L |15,11000,s\n", "7 Chain Response[ER Sepsis Triage, IV Antibiotics] |A.org:group is L |T.org:group is L |15,11000,s\n", "8 Chain Precedence[Admission IC, Admission NC] |A.org:group is J |T.org:group is J |\n", "9 Chain Precedence[IV Antibiotics, Admission NC] |A.org:group is F |T.org:group is A |92,14459,s\n", "10 Chain Precedence[Admission NC, Release B] |A.org:group is E |T.org:group is K |48225,48225,s\n", "11 Chain Response[Admission IC, Admission NC] |A.org:group is J |T.org:group is J |61534,61534,s\n", "12 Chain Response[LacticAcid, Leucocytes] |A.LacticAcid <= 0.8 |T.Leucocytes >= 13.8 |0,2778,m\n", "13 Chain Precedence[ER Registration, ER Triage] |A.org:group is C |(T.InfectionSuspected is true) AND (T.SIRSCritTemperature is true) AND (T.DiagnosticLacticAcid is true) AND (T.DiagnosticBlood is true) AND (T.DiagnosticIC is true) AND (T.SIRSCriteria2OrMore is true) AND (T.DiagnosticECG is true) |52,2154,s\n" ] } ], "execution_count": 4 }, { "cell_type": "markdown", "id": "e2a96f45", "metadata": {}, "source": [ "The class `MPDeclareAnalyzer` initializes the DECLARE conformance checking (Declare4Py implements the MP DECLARE analyzer algorithm). The `MPDeclareAnalyzer` constructor takes as an input the boolean parameter `consider_vacuity=true` that means that vacuously satisfied traces are considered as satisfied, violated otherwise. The constructor also needs the `event_log` and the `declare_model` objects. After this setting, the method `run` of the `MPDeclareAnalyzer` class will execute the task." ] }, { "cell_type": "code", "id": "52f2679d", "metadata": { "ExecuteTime": { "end_time": "2026-05-29T14:06:26.180113400Z", "start_time": "2026-05-29T14:06:24.555797700Z" } }, "source": [ "from Declare4Py.ProcessMiningTasks.ConformanceChecking.MPDeclareAnalyzer import MPDeclareAnalyzer\n", "from Declare4Py.ProcessMiningTasks.ConformanceChecking.MPDeclareResultsBrowser import MPDeclareResultsBrowser\n", "\n", "\n", "basic_checker = MPDeclareAnalyzer(log=event_log, declare_model=declare_model, consider_vacuity=False)\n", "conf_check_res: MPDeclareResultsBrowser = basic_checker.run()" ], "outputs": [], "execution_count": 5 }, { "cell_type": "markdown", "id": "d3592687", "metadata": {}, "source": [ "The result of the `run` method is a `ResultsBrowser` object that allows for the retrieval of the conformance checking results with the `get_metric()` method. This takes as input the `metric` parameter with values in `num_pendings`, `num_activations`, `num_fulfillments`, `num_violations` and `state`. This return a table whose rows are the results of each trace according to the DECLARE constraints in the model (as columns). For example, this execution" ] }, { "cell_type": "code", "id": "88771d4a", "metadata": { "ExecuteTime": { "end_time": "2026-05-29T14:06:26.323129100Z", "start_time": "2026-05-29T14:06:26.195609200Z" } }, "source": [ "conf_check_res.get_metric(metric=\"num_activations\")" ], "outputs": [ { "data": { "text/plain": [ " Existence2[Admission NC] | | \\\n", "0 None \n", "1 None \n", "2 None \n", "3 None \n", "4 None \n", "... ... \n", "1045 None \n", "1046 None \n", "1047 None \n", "1048 None \n", "1049 None \n", "\n", " Chain Response[Admission NC, Release B] |A.org:group is K |T.org:group is E | \\\n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "... ... \n", "1045 0 \n", "1046 0 \n", "1047 0 \n", "1048 0 \n", "1049 0 \n", "\n", " Chain Response[Admission NC, Release A] |A.org:group is I |T.org:group is E |133020,957701,s \\\n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "... ... \n", "1045 0 \n", "1046 0 \n", "1047 0 \n", "1048 0 \n", "1049 0 \n", "\n", " Chain Precedence[IV Liquid, Admission NC] |A.org:group is I |T.org:group is A |92,14473,s \\\n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "... ... \n", "1045 0 \n", "1046 0 \n", "1047 0 \n", "1048 0 \n", "1049 0 \n", "\n", " Chain Response[ER Registration, ER Triage] |(A.DiagnosticArtAstrup is false) AND (A.SIRSCritHeartRate is true) AND (A.org:group is A) AND (A.DiagnosticBlood is true) AND (A.DisfuncOrg is false) AND (A.DiagnosticECG is true) AND (A.Age >= 45) AND (A.InfectionSuspected is true) AND (A.DiagnosticLacticAcid is true) AND (A.DiagnosticSputum is true) AND (A.Hypoxie is false) AND (A.DiagnosticUrinaryCulture is true) AND (A.DiagnosticLiquor is false) AND (A.SIRSCritTemperature is true) AND (A.Infusion is true) AND (A.Hypotensie is false) AND (A.DiagnosticUrinarySediment is true) AND (A.Oligurie is false) AND (A.Age <= 80) AND (A.SIRSCritTachypnea is true) AND (A.DiagnosticOther is false) AND (A.SIRSCritLeucos is false) AND (A.DiagnosticIC is true) AND (A.SIRSCriteria2OrMore is true) AND (A.DiagnosticXthorax is true) |T.org:group is C |52,2154,s \\\n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "... ... \n", "1045 0 \n", "1046 0 \n", "1047 0 \n", "1048 0 \n", "1049 0 \n", "\n", " Chain Precedence[Release A, Return ER] |A.org:group is ? |T.org:group is E |1121801,1121801,s \\\n", "0 0 \n", "1 0 \n", "2 0 \n", "3 1 \n", "4 0 \n", "... ... \n", "1045 0 \n", "1046 0 \n", "1047 0 \n", "1048 0 \n", "1049 0 \n", "\n", " Chain Precedence[ER Sepsis Triage, IV Antibiotics] |A.org:group is L |T.org:group is L |15,11000,s \\\n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "... ... \n", "1045 0 \n", "1046 0 \n", "1047 0 \n", "1048 0 \n", "1049 0 \n", "\n", " Chain Response[ER Sepsis Triage, IV Antibiotics] |A.org:group is L |T.org:group is L |15,11000,s \\\n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "... ... \n", "1045 0 \n", "1046 0 \n", "1047 0 \n", "1048 0 \n", "1049 1 \n", "\n", " Chain Precedence[Admission IC, Admission NC] |A.org:group is J |T.org:group is J | \\\n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "... ... \n", "1045 0 \n", "1046 0 \n", "1047 0 \n", "1048 0 \n", "1049 0 \n", "\n", " Chain Precedence[IV Antibiotics, Admission NC] |A.org:group is F |T.org:group is A |92,14459,s \\\n", "0 0 \n", "1 1 \n", "2 0 \n", "3 1 \n", "4 0 \n", "... ... \n", "1045 1 \n", "1046 0 \n", "1047 0 \n", "1048 0 \n", "1049 0 \n", "\n", " Chain Precedence[Admission NC, Release B] |A.org:group is E |T.org:group is K |48225,48225,s \\\n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "... ... \n", "1045 0 \n", "1046 0 \n", "1047 0 \n", "1048 0 \n", "1049 0 \n", "\n", " Chain Response[Admission IC, Admission NC] |A.org:group is J |T.org:group is J |61534,61534,s \\\n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "... ... \n", "1045 0 \n", "1046 0 \n", "1047 0 \n", "1048 0 \n", "1049 0 \n", "\n", " Chain Response[LacticAcid, Leucocytes] |A.LacticAcid <= 0.8 |T.Leucocytes >= 13.8 |0,2778,m \\\n", "0 0 \n", "1 1 \n", "2 0 \n", "3 0 \n", "4 0 \n", "... ... \n", "1045 0 \n", "1046 0 \n", "1047 0 \n", "1048 1 \n", "1049 0 \n", "\n", " Chain Precedence[ER Registration, ER Triage] |A.org:group is C |(T.InfectionSuspected is true) AND (T.SIRSCritTemperature is true) AND (T.DiagnosticLacticAcid is true) AND (T.DiagnosticBlood is true) AND (T.DiagnosticIC is true) AND (T.SIRSCriteria2OrMore is true) AND (T.DiagnosticECG is true) |52,2154,s \n", "0 1 \n", "1 1 \n", "2 1 \n", "3 1 \n", "4 1 \n", "... ... \n", "1045 1 \n", "1046 1 \n", "1047 1 \n", "1048 1 \n", "1049 1 \n", "\n", "[1050 rows x 14 columns]" ], "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Existence2[Admission NC] | |Chain Response[Admission NC, Release B] |A.org:group is K |T.org:group is E |Chain Response[Admission NC, Release A] |A.org:group is I |T.org:group is E |133020,957701,sChain Precedence[IV Liquid, Admission NC] |A.org:group is I |T.org:group is A |92,14473,sChain Response[ER Registration, ER Triage] |(A.DiagnosticArtAstrup is false) AND (A.SIRSCritHeartRate is true) AND (A.org:group is A) AND (A.DiagnosticBlood is true) AND (A.DisfuncOrg is false) AND (A.DiagnosticECG is true) AND (A.Age >= 45) AND (A.InfectionSuspected is true) AND (A.DiagnosticLacticAcid is true) AND (A.DiagnosticSputum is true) AND (A.Hypoxie is false) AND (A.DiagnosticUrinaryCulture is true) AND (A.DiagnosticLiquor is false) AND (A.SIRSCritTemperature is true) AND (A.Infusion is true) AND (A.Hypotensie is false) AND (A.DiagnosticUrinarySediment is true) AND (A.Oligurie is false) AND (A.Age <= 80) AND (A.SIRSCritTachypnea is true) AND (A.DiagnosticOther is false) AND (A.SIRSCritLeucos is false) AND (A.DiagnosticIC is true) AND (A.SIRSCriteria2OrMore is true) AND (A.DiagnosticXthorax is true) |T.org:group is C |52,2154,sChain Precedence[Release A, Return ER] |A.org:group is ? |T.org:group is E |1121801,1121801,sChain Precedence[ER Sepsis Triage, IV Antibiotics] |A.org:group is L |T.org:group is L |15,11000,sChain Response[ER Sepsis Triage, IV Antibiotics] |A.org:group is L |T.org:group is L |15,11000,sChain Precedence[Admission IC, Admission NC] |A.org:group is J |T.org:group is J |Chain Precedence[IV Antibiotics, Admission NC] |A.org:group is F |T.org:group is A |92,14459,sChain Precedence[Admission NC, Release B] |A.org:group is E |T.org:group is K |48225,48225,sChain Response[Admission IC, Admission NC] |A.org:group is J |T.org:group is J |61534,61534,sChain Response[LacticAcid, Leucocytes] |A.LacticAcid <= 0.8 |T.Leucocytes >= 13.8 |0,2778,mChain Precedence[ER Registration, ER Triage] |A.org:group is C |(T.InfectionSuspected is true) AND (T.SIRSCritTemperature is true) AND (T.DiagnosticLacticAcid is true) AND (T.DiagnosticBlood is true) AND (T.DiagnosticIC is true) AND (T.SIRSCriteria2OrMore is true) AND (T.DiagnosticECG is true) |52,2154,s
0None0000000000001
1None0000000010011
2None0000000000001
3None0000100010001
4None0000000000001
.............................................
1045None0000000010001
1046None0000000000001
1047None0000000000001
1048None0000000000011
1049None0000001000001
\n", "

1050 rows × 14 columns

\n", "
" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "execution_count": 6 }, { "cell_type": "markdown", "id": "3bea5689", "metadata": {}, "source": "returns the number of activations of each trace (rows) for each column. We can also specify a `trace_id`, a `constraint_id` or both (we see an example with the constraint `Chain Response[LacticAcid, Leucocytes] |A.LacticAcid <= 0.8 |T.Leucocytes >= 13.8 |0,2778,m` at index 13):" }, { "cell_type": "code", "id": "7178f443", "metadata": { "ExecuteTime": { "end_time": "2026-05-29T14:06:26.417654Z", "start_time": "2026-05-29T14:06:26.376148900Z" } }, "source": [ "# Number of activations for the second trace\n", "print(conf_check_res.get_metric(trace_id=1, metric=\"num_activations\"))\n", "print(\"-------------------------------------------\")\n", "\n", "# Number of activations for the constraint with id=12\n", "print(conf_check_res.get_metric(constr_id=12, metric=\"num_activations\"))\n", "print(\"-------------------------------------------\")\n", "\n", "# Number of activations for the second trace and for the constraint with id=12\n", "conf_check_res.get_metric(trace_id=1, constr_id=12, metric=\"num_activations\")" ], "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[None, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1]\n", "-------------------------------------------\n", "[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0]\n", "-------------------------------------------\n" ] }, { "data": { "text/plain": [ "1" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "execution_count": 7 }, { "cell_type": "markdown", "id": "990d73ad", "metadata": {}, "source": [ "Similar retrievals can be done for the other metrics. For example, the `state` metric return 1 if the constraint is satisfied in the trace and 0 otherwise:" ] }, { "cell_type": "code", "id": "e0e33715", "metadata": { "ExecuteTime": { "end_time": "2026-05-29T14:06:26.851027900Z", "start_time": "2026-05-29T14:06:26.834028100Z" } }, "source": [ "# Truth values for the second trace\n", "print(conf_check_res.get_metric(trace_id=1, metric=\"state\"))\n", "print(\"-------------------------------------------\")\n", "\n", "# Truth values for the constraint with id=12\n", "print(conf_check_res.get_metric(constr_id=12, metric=\"state\"))\n", "print(\"-------------------------------------------\")\n", "\n", "# Truth value for the second trace and for the constraint with id=12\n", "print(conf_check_res.get_metric(trace_id=1, constr_id=12, metric=\"state\"))" ], "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0]\n", "-------------------------------------------\n", "[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n", "-------------------------------------------\n", "1\n" ] } ], "execution_count": 8 } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.4" } }, "nbformat": 4, "nbformat_minor": 5 }