File size: 2,306 Bytes
c2ea5ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
"""
Causal Analysis and Relationship Inference

This module handles the fifth stage of the agent monitoring pipeline:
- Causal analysis of knowledge graphs and perturbation test results
- Component analysis and influence measurement
- Confounder detection and analysis
- DoWhy-based causal inference
- Graph-based causal reasoning

Functional Organization:
- causal_interface: Main interface for causal analysis
- component_analysis: Component-level causal analysis methods
- influence_analysis: Influence measurement and analysis
- dowhy_analysis: DoWhy-based causal inference
- graph_analysis: Graph-based causal reasoning
- confounders: Confounder detection methods
- utils: Utility functions for causal analysis

Usage:
    from agentgraph.causal import CausalAnalysisInterface
    from agentgraph.causal import calculate_average_treatment_effect
    from agentgraph.causal import detect_confounders
"""

# Main interface (pure functions)
from .causal_interface import analyze_causal_effects, enrich_knowledge_graph, generate_report

# Core analysis methods
from .component_analysis import (
    calculate_average_treatment_effect,
    granger_causality_test,
    compute_causal_effect_strength
)

from .influence_analysis import (
    analyze_component_influence,
    evaluate_model,
    identify_key_components
)

from .dowhy_analysis import (
    run_dowhy_analysis,
    analyze_components_with_dowhy,
    generate_simple_causal_graph
)

from .graph_analysis import (
    CausalGraph,
    CausalAnalyzer,
    enrich_knowledge_graph,
    generate_summary_report
)

# Subdirectories
from . import confounders
from . import utils

__all__ = [
    # Main interface (pure functions)
    'analyze_causal_effects',
    'enrich_knowledge_graph', 
    'generate_report',
    
    # Component analysis
    'calculate_average_treatment_effect',
    'granger_causality_test', 
    'compute_causal_effect_strength',
    
    # Influence analysis
    'analyze_component_influence',
    'evaluate_model',
    'identify_key_components',
    
    # DoWhy analysis
    'run_dowhy_analysis',
    'analyze_components_with_dowhy',
    'generate_simple_causal_graph',
    
    # Graph analysis
    'CausalGraph',
    'CausalAnalyzer',
    'generate_summary_report',
    
    # Submodules
    'confounders',
    'utils'
]