causal-abstraction-eval 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,177 @@
1
+ """
2
+ Causal abstraction library
3
+
4
+ A framework for validating causal explanations of complex systems.
5
+ """
6
+
7
+ from importlib.metadata import PackageNotFoundError, version as _version
8
+
9
+ try:
10
+ # Read from the installed distribution metadata (distribution name
11
+ # "causal_abstraction_eval"); pyproject.toml is the single source of truth.
12
+ __version__ = _version("causal_abstraction_eval")
13
+ except PackageNotFoundError: # running from an un-installed source checkout
14
+ __version__ = "0.0.0+unknown"
15
+
16
+ # Analytical metrics
17
+ from .analytical_metrics import (
18
+ AnalyticalMetric,
19
+ StructuralDeviationMetric,
20
+ CausalSensitivityIndexMetric,
21
+ MallowsCpMetric,
22
+ IBLagrangianMetric,
23
+ CIBLagrangianMetric,
24
+ MacroscopicInvarianceMetric,
25
+ ComplexityShiftMetric,
26
+ SobolSensitivityMetric,
27
+ IIAMetric,
28
+ BCCMetric,
29
+ ProbingMetric,
30
+ InfidelityMetric,
31
+ SymbionMetric,
32
+ DCCMetric,
33
+ RelationalFidelityMetric,
34
+ )
35
+ from .config import EvaluationConfig
36
+ from .engine import EvaluationEngine
37
+ from .experiment import ExperimentResults, AnalyticalResults
38
+ # Metrics
39
+ from .metrics import (
40
+ EvaluationMetric,
41
+ SubspaceCheckMetric,
42
+ L2Metric,
43
+ MSEMetric,
44
+ RMSEMetric,
45
+ NMSEMetric,
46
+ R2Metric,
47
+ JSDivergenceMetric,
48
+ KLDivergenceMetric,
49
+ PrecisionMetric,
50
+ MMDMetric,
51
+ TrajectoryMSEMetric,
52
+ DTWMetric,
53
+ TemporalAutocorrelationMetric,
54
+ SpectralMetric,
55
+ ConditionalIndependenceMetric,
56
+ VarianceDecompositionMetric,
57
+ get_metric,
58
+ )
59
+ from .models.high_level import CausalGraph
60
+ from .models.low_level import LowLevelModel, NoisyLowLevelModel
61
+ # NeuralModel is imported lazily (see __getattr__ below) so that a bare
62
+ # `import causal_abstraction` does not eagerly load torch.
63
+ from .paths import DiagramBuilder, CausalPath
64
+ from .primitives import SystemState, AbstractVariable, ProbabilityDistribution, EmpiricalDistribution, UNMAPPED, \
65
+ DiscreteDistribution
66
+ from .sampling import (
67
+ TopDownSampler, BottomUpSampler, InterventionSampler,
68
+ PairedSampler, NoisyMeasurementSampler, CombinedFaithfulnessSampler,
69
+ PHI_DUMMY_NAME,
70
+ )
71
+ from .schema import MicroVariableSchema, CoarseGrainingMap, MicroSelector, Variable
72
+ from .spaces.base import (
73
+ Subspace, RectSubspace, SphereSubspace, UnionSubspace,
74
+ ComplementSubspace, FullSubspace, UniformSubspace,
75
+ GaussianSubspace
76
+ )
77
+ from .tasks import StandardTasks, EvaluationTask, TaskResults
78
+ from .valuemap import ValueMap, ContinuousValueMap
79
+
80
+ __all__ = [
81
+ # Version
82
+ "__version__",
83
+ # Core primitives
84
+ "SystemState",
85
+ "AbstractVariable",
86
+ "Variable",
87
+ "ProbabilityDistribution",
88
+ "EmpiricalDistribution",
89
+ "UNMAPPED",
90
+ "DiscreteDistribution",
91
+ # Schema & mapping
92
+ "MicroVariableSchema",
93
+ "CoarseGrainingMap",
94
+ "MicroSelector",
95
+ "ValueMap",
96
+ "ContinuousValueMap",
97
+ # Config & results
98
+ "EvaluationConfig",
99
+ "ExperimentResults",
100
+ "AnalyticalResults",
101
+ # Engine
102
+ "EvaluationEngine",
103
+ # Samplers
104
+ "TopDownSampler",
105
+ "BottomUpSampler",
106
+ "InterventionSampler",
107
+ "PairedSampler",
108
+ "NoisyMeasurementSampler",
109
+ "CombinedFaithfulnessSampler",
110
+ "PHI_DUMMY_NAME",
111
+ # Models
112
+ "LowLevelModel",
113
+ "NoisyLowLevelModel",
114
+ "CausalGraph",
115
+ "NeuralModel",
116
+ # Spaces
117
+ "Subspace",
118
+ "RectSubspace",
119
+ "SphereSubspace",
120
+ "UnionSubspace",
121
+ "ComplementSubspace",
122
+ "FullSubspace",
123
+ "UniformSubspace",
124
+ "GaussianSubspace",
125
+ # Paths
126
+ "DiagramBuilder",
127
+ "CausalPath",
128
+ # EvaluationMetric classes
129
+ "EvaluationMetric",
130
+ "SubspaceCheckMetric",
131
+ "L2Metric",
132
+ "MSEMetric",
133
+ "RMSEMetric",
134
+ "NMSEMetric",
135
+ "R2Metric",
136
+ "JSDivergenceMetric",
137
+ "KLDivergenceMetric",
138
+ "PrecisionMetric",
139
+ "MMDMetric",
140
+ "TrajectoryMSEMetric",
141
+ "DTWMetric",
142
+ "TemporalAutocorrelationMetric",
143
+ "SpectralMetric",
144
+ "ConditionalIndependenceMetric",
145
+ "VarianceDecompositionMetric",
146
+ "get_metric",
147
+ # AnalyticalMetric classes
148
+ "AnalyticalMetric",
149
+ "StructuralDeviationMetric",
150
+ "CausalSensitivityIndexMetric",
151
+ "MallowsCpMetric",
152
+ "IBLagrangianMetric",
153
+ "CIBLagrangianMetric",
154
+ "MacroscopicInvarianceMetric",
155
+ "ComplexityShiftMetric",
156
+ "SobolSensitivityMetric",
157
+ "IIAMetric",
158
+ "BCCMetric",
159
+ "DCCMetric",
160
+ "ProbingMetric",
161
+ "InfidelityMetric",
162
+ "SymbionMetric",
163
+ "RelationalFidelityMetric",
164
+ # Tasks
165
+ "StandardTasks",
166
+ "EvaluationTask",
167
+ "TaskResults",
168
+ ]
169
+
170
+
171
+ def __getattr__(name):
172
+ # PEP 562 lazy attribute access: defer the torch import behind
173
+ # NeuralModel so a bare `import causal_abstraction` stays lightweight.
174
+ if name == "NeuralModel":
175
+ from .models.neural import NeuralModel
176
+ return NeuralModel
177
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")