Causal Discovery Algorithms package
This package contains the relevant causal discovery algorithms that can be applied on process data to discover causal relationships between activities within the process.
The current algorithm implementation include DirectLINGAM algorithm.
Additional causal discovery algorithms can be added to the package as long as they extend the sax.causal_process_discovery.algorithms.base_causal_alg.BaseCausalAlgorithm
class.
Submodules
sax.core.causal_process_discovery.algorithms.base_causal_alg module
- class sax.core.causal_process_discovery.algorithms.base_causal_alg.BaseCausalAlgorithm(data: DataFrame, prior_knowledge: PriorKnowledge | None = None)
Bases:
object
Parent class for all causal discovery algorithms implementations. Please extend this class to add more algorithms.
- abstract run() ResultInfo
Run the causal discovery algorithm and return the result
Returns
- return:
A object holding the causal discovery result
- rtype:
ResultInfo
Raises
- raises NotImplementedError:
- exception sax.core.causal_process_discovery.algorithms.base_causal_alg.CausalDataException(message)
Bases:
Exception
Exception indicating that the data object containing process data is not suitable for causal discovery in its present form.
- Parameters:
Exception -- exception indicating the reason why the process data object is not suitable for causal discovery
- class sax.core.causal_process_discovery.algorithms.base_causal_alg.CausalResultInfo(adjacencyMatrix: List[List[int]], columns: List[str])
Bases:
ResultInfo
Class containing causal discovery results. Basically this is a wrapper around causal adjacency matrix.
- getAdjacencyMatrix() List[List[int]]
Return causal adjacency matrix contained within this object
- Returns:
causal adjacency matrix
- Return type:
List[List[int]]
- getColumns() List[str]
Return a list with the names of the columns appearing in the adjacency matrix
- Returns:
List of column names
- Return type:
List[str]
- getDiscoveryResult() str
Return a NL description of the causal relationships
- Returns:
Textual description of causal relationships
- Return type:
str
sax.core.causal_process_discovery.algorithms.lingam module
- class sax.core.causal_process_discovery.algorithms.lingam.LingamImpl(data: DataFrame, prior_knowledge: PriorKnowledge | None = None)
Bases:
BaseCausalAlgorithm
DirectLINGAM causal discovery algorithm wrapper for process execution causal discovery. Make use of DirectLINGAM algorithm
- Parameters:
BaseCausalAlgorithm (BaseCausalAlgorithm) -- base type
- run() CausalResultInfo
Runs DirectLINGAM on the data the algorithm instance was initiated with, and returns result object containing LINGAM adjaceny matrix.
- Returns:
CausalResultInfo
- Return type:
- sanity_check()
Sanity check for LINGAM, validates that the data on which it is run does not contain NaN values.
- Raises:
CausalDataException -- throws exception in case data contains NaN values.