causing 2.4.6__tar.gz → 2.5.1__tar.gz
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.
- {causing-2.4.6 → causing-2.5.1}/PKG-INFO +6 -6
- {causing-2.4.6 → causing-2.5.1}/causing/model.py +11 -3
- {causing-2.4.6 → causing-2.5.1}/causing.egg-info/PKG-INFO +6 -6
- causing-2.5.1/causing.egg-info/requires.txt +6 -0
- {causing-2.4.6 → causing-2.5.1}/setup.py +10 -6
- {causing-2.4.6 → causing-2.5.1}/tests/test_model.py +29 -0
- causing-2.4.6/causing.egg-info/requires.txt +0 -6
- {causing-2.4.6 → causing-2.5.1}/LICENSE.md +0 -0
- {causing-2.4.6 → causing-2.5.1}/README.md +0 -0
- {causing-2.4.6 → causing-2.5.1}/causing/__init__.py +0 -0
- {causing-2.4.6 → causing-2.5.1}/causing/graph.py +0 -0
- {causing-2.4.6 → causing-2.5.1}/causing/utils.py +0 -0
- {causing-2.4.6 → causing-2.5.1}/causing.egg-info/SOURCES.txt +0 -0
- {causing-2.4.6 → causing-2.5.1}/causing.egg-info/dependency_links.txt +0 -0
- {causing-2.4.6 → causing-2.5.1}/causing.egg-info/top_level.txt +0 -0
- {causing-2.4.6 → causing-2.5.1}/setup.cfg +0 -0
- {causing-2.4.6 → causing-2.5.1}/tests/__init__.py +0 -0
- {causing-2.4.6 → causing-2.5.1}/tests/examples/__init__.py +0 -0
- {causing-2.4.6 → causing-2.5.1}/tests/examples/models.py +0 -0
- {causing-2.4.6 → causing-2.5.1}/tests/test_estimate.py +0 -0
- {causing-2.4.6 → causing-2.5.1}/tests/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: causing
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.1
|
|
4
4
|
Summary: Causing: CAUSal INterpretation using Graphs
|
|
5
5
|
Home-page: https://github.com/realrate/Causing
|
|
6
6
|
Author: Dr. Holger Bartel
|
|
@@ -11,11 +11,11 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: >=3.9
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE.md
|
|
14
|
-
Requires-Dist: numpy
|
|
15
|
-
Requires-Dist: pandas
|
|
16
|
-
Requires-Dist: scipy
|
|
17
|
-
Requires-Dist: sympy
|
|
18
|
-
Requires-Dist: networkx
|
|
14
|
+
Requires-Dist: numpy>=1.23
|
|
15
|
+
Requires-Dist: pandas>=1.3
|
|
16
|
+
Requires-Dist: scipy>=1.9
|
|
17
|
+
Requires-Dist: sympy>=1.5
|
|
18
|
+
Requires-Dist: networkx>=2.7
|
|
19
19
|
Requires-Dist: pre-commit
|
|
20
20
|
Dynamic: author
|
|
21
21
|
Dynamic: author-email
|
|
@@ -2,13 +2,18 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass, field
|
|
4
4
|
from typing import Sequence, Callable
|
|
5
|
-
from functools import cached_property
|
|
5
|
+
from functools import cached_property, reduce
|
|
6
6
|
import networkx
|
|
7
7
|
|
|
8
8
|
import sympy
|
|
9
9
|
import numpy as np
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
def _vectorized_max(*args):
|
|
13
|
+
"""Elementwise maximum over any number of scalars/arrays (sympy.Max)."""
|
|
14
|
+
return reduce(np.maximum, args)
|
|
15
|
+
|
|
16
|
+
|
|
12
17
|
class NumericModelError(Exception):
|
|
13
18
|
pass
|
|
14
19
|
|
|
@@ -196,8 +201,11 @@ class Model:
|
|
|
196
201
|
# Define placeholder for vectorized max function
|
|
197
202
|
vectorized_max = sympy.Function("vectorized_max")
|
|
198
203
|
|
|
199
|
-
# Define custom translation mapping
|
|
200
|
-
|
|
204
|
+
# Define custom translation mapping. sympy.Max takes any number of
|
|
205
|
+
# arguments, np.maximum only two: a third positional argument is its
|
|
206
|
+
# `out` array, so Max(a, b, c) silently became max(a, b) (and overwrote
|
|
207
|
+
# c). Reduce pairwise over all arguments instead.
|
|
208
|
+
custom_modules = [{"vectorized_max": _vectorized_max}, "numpy"]
|
|
201
209
|
|
|
202
210
|
for i, eq in enumerate(self.equations):
|
|
203
211
|
# Replace sympy.Max with our placeholder
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: causing
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.1
|
|
4
4
|
Summary: Causing: CAUSal INterpretation using Graphs
|
|
5
5
|
Home-page: https://github.com/realrate/Causing
|
|
6
6
|
Author: Dr. Holger Bartel
|
|
@@ -11,11 +11,11 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: >=3.9
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE.md
|
|
14
|
-
Requires-Dist: numpy
|
|
15
|
-
Requires-Dist: pandas
|
|
16
|
-
Requires-Dist: scipy
|
|
17
|
-
Requires-Dist: sympy
|
|
18
|
-
Requires-Dist: networkx
|
|
14
|
+
Requires-Dist: numpy>=1.23
|
|
15
|
+
Requires-Dist: pandas>=1.3
|
|
16
|
+
Requires-Dist: scipy>=1.9
|
|
17
|
+
Requires-Dist: sympy>=1.5
|
|
18
|
+
Requires-Dist: networkx>=2.7
|
|
19
19
|
Requires-Dist: pre-commit
|
|
20
20
|
Dynamic: author
|
|
21
21
|
Dynamic: author-email
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="causing",
|
|
8
|
-
version="2.
|
|
8
|
+
version="2.5.1",
|
|
9
9
|
author="Dr. Holger Bartel",
|
|
10
10
|
author_email="holger.bartel@realrate.ai",
|
|
11
11
|
description="Causing: CAUSal INterpretation using Graphs",
|
|
@@ -19,11 +19,15 @@ setuptools.setup(
|
|
|
19
19
|
"Operating System :: OS Independent",
|
|
20
20
|
],
|
|
21
21
|
install_requires=[
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
22
|
+
# Lower-bound floors only: the previous `~=` upper caps blocked numpy 2 /
|
|
23
|
+
# pandas 2+ / networkx 3 and made Python 3.14 impossible (no pandas 1.x cp314
|
|
24
|
+
# wheels). Verified numerically equivalent across the stack jump — see
|
|
25
|
+
# https://github.com/realrate/RealRate-Private/issues/2098
|
|
26
|
+
"numpy>=1.23",
|
|
27
|
+
"pandas>=1.3",
|
|
28
|
+
"scipy>=1.9",
|
|
29
|
+
"sympy>=1.5",
|
|
30
|
+
"networkx>=2.7",
|
|
27
31
|
"pre-commit", # TODO: move to dev-requirements
|
|
28
32
|
],
|
|
29
33
|
python_requires=">=3.9",
|
|
@@ -448,5 +448,34 @@ class TestEndToEndWorkflow(unittest.TestCase):
|
|
|
448
448
|
self.assertEqual(effects["yhat"].shape, (1, 3))
|
|
449
449
|
|
|
450
450
|
|
|
451
|
+
class TestMaxWithManyArguments(unittest.TestCase):
|
|
452
|
+
"""sympy.Max with more than two arguments must use all of them.
|
|
453
|
+
|
|
454
|
+
np.maximum(a, b, c) treats c as the output array, so the third argument was
|
|
455
|
+
silently dropped (RealRate de_health_insurance ZÜVN, found 14.11.2026).
|
|
456
|
+
"""
|
|
457
|
+
|
|
458
|
+
def test_three_argument_max_uses_every_argument(self):
|
|
459
|
+
from sympy import Max
|
|
460
|
+
|
|
461
|
+
X1, X2, Y1 = symbols(["X1", "X2", "Y1"])
|
|
462
|
+
m = Model(xvars=[X1, X2], yvars=[Y1], equations=(Max(X1, X2, 0),), final_var=Y1)
|
|
463
|
+
xdat = np.array([[1.0, -5.0, -1.0, 3.0], [2.0, -2.0, 4.0, -7.0]])
|
|
464
|
+
x_before = xdat.copy()
|
|
465
|
+
|
|
466
|
+
yhat = m.compute(xdat)
|
|
467
|
+
|
|
468
|
+
np.testing.assert_allclose(yhat[0], [2.0, 0.0, 4.0, 3.0])
|
|
469
|
+
np.testing.assert_array_equal(xdat, x_before) # inputs not overwritten
|
|
470
|
+
|
|
471
|
+
def test_two_argument_max_unchanged(self):
|
|
472
|
+
from sympy import Max
|
|
473
|
+
|
|
474
|
+
X1, Y1 = symbols(["X1", "Y1"])
|
|
475
|
+
m = Model(xvars=[X1], yvars=[Y1], equations=(Max(X1, 0),), final_var=Y1)
|
|
476
|
+
yhat = m.compute(np.array([[-1.0, 2.0]]))
|
|
477
|
+
np.testing.assert_allclose(yhat[0], [0.0, 2.0])
|
|
478
|
+
|
|
479
|
+
|
|
451
480
|
if __name__ == "__main__":
|
|
452
481
|
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|