From 491944df1e4e74e00f8448a4d161bd6a9ebff5f6 Mon Sep 17 00:00:00 2001 From: Keith Battocchi Date: Wed, 5 Aug 2026 09:19:45 -0400 Subject: [PATCH] Finish the scipy-doctest migration by dropping numeric ellipses doc/conf.py monkey-patches scipy-doctest's DTChecker as doctest.OutputChecker so that float output is compared numerically (rtol=0.01, atol=1e-8) rather than as text. The migration to it was deliberately partial: 365 numeric ellipses across 143 lines were left in place. Those ellipses actively defeat the checker. A token like `0.516888...` cannot be parsed as a float, so DTChecker falls back to literal string comparison and any benign last-digit drift breaks the build. That is the opposite of what the checker is for, and it is why the nightly currently reports 8 doctest failures of which 7 are drift of ~6e-5 to ~0.8%. Remove them. Digits are left exactly as they were wherever the recorded value already carried enough precision, so no expected value is regenerated and a real regression cannot be silently blessed by this commit. Sixteen examples did need new values, because they had been recorded at only two or three decimals. Literal prefix matching tolerated that; a relative comparison cannot (`0.35` against `0.35952902` is 2.65% off, and `-0.00` against `-0.00881137` is 100% off). Those are rewritten at full precision, taken from an environment matching the docs job. grf.RegressionForest needed a change of a different kind. Its example generated data with `n_informative=2` out of 4 features, so two of the four printed importances were structurally ~0 (6.6e-5) while rtol allows them only +/-8e-7 -- and importances are a forest quantity, where near-tied splits can move them. Rounding does not rescue it: at round(3) the leading 0.88558872 sits 0.01% from the 0.8855 boundary. Instead make all four features informative, which lifts the smallest importance to 0.0365, about 500x further from zero. Note that the ellipsis form was never actually safer near zero, only brittle in a different direction: `0.00...` rejects a value of -1e-9 outright on a sign flip. The durable fix is to prefer DGPs whose printed values sit well away from zero. Verified by running the real docs-job command (sphinx-build -b doctest) under Python 3.12 with the current lkg.txt: 290 tests, 0 failures. Repeated under OPENBLAS_CORETYPE=Nehalem to shake out values sensitive to BLAS kernel selection (the failure mode behind the recent ForestDRIV flake): also 290 tests, 0 failures. This does not attempt the sklearn 1.9 refresh. That needs an lkg.txt bump and is left to a follow-up, which this commit makes tractable by reducing the nightly failures from 8 to the 1 that reflects a genuine behavior change. Signed-off-by: Keith Battocchi Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f11774e2-02be-42fa-a2b9-429871322083 --- econml/_ortho_learner.py | 26 ++++++------- econml/dml/_rlearner.py | 10 ++--- econml/dml/causal_forest.py | 6 +-- econml/dml/dml.py | 52 ++++++++++++------------- econml/dr/_drlearner.py | 58 ++++++++++++++-------------- econml/grf/classes.py | 6 +-- econml/iv/dml/_dml.py | 24 ++++++------ econml/iv/dr/_dr.py | 52 ++++++++++++------------- econml/metalearners/_metalearners.py | 8 ++-- econml/panel/dml/_dml.py | 46 +++++++++++----------- 10 files changed, 144 insertions(+), 144 deletions(-) diff --git a/econml/_ortho_learner.py b/econml/_ortho_learner.py index e27b47a67..bdb8c898c 100644 --- a/econml/_ortho_learner.py +++ b/econml/_ortho_learner.py @@ -192,8 +192,8 @@ def predict(self, X, y, W=None): X, y,W=y, Z=None) >>> nuisance - (array([-1.105728... , -1.537566..., -2.451827... , ..., 1.106287..., - -1.829662..., -1.782273...], shape=(5000,)),) + (array([-1.1057289 , -1.53756637, -2.4518278 , ..., 1.10628792, + -1.82966233, -1.78227335], shape=(5000,)),) >>> model_list [, ] >>> fitted_inds @@ -475,19 +475,19 @@ def _gen_ortho_learner_model_final(self): est.fit(y, X[:, 0], W=X[:, 1:]) >>> est.score_ - np.float64(0.00756830...) + np.float64(0.00756830) >>> est.const_marginal_effect() - np.float64(1.02364992...) + np.float64(1.02364992) >>> est.effect() - array([1.023649...]) + array([1.023649]) >>> est.effect(T0=0, T1=10) - array([10.236499...]) + array([10.236499]) >>> est.score(y, X[:, 0], W=X[:, 1:]) - np.float64(0.00727995...) + np.float64(0.00727995) >>> est.ortho_learner_model_final_.model LinearRegression(fit_intercept=False) >>> est.ortho_learner_model_final_.model.coef_ - array([1.023649...]) + array([1.023649]) The following example shows how to do double machine learning with discrete treatments, using the _OrthoLearner: @@ -533,15 +533,15 @@ def _gen_ortho_learner_model_final(self): est.fit(y, T, W=W) >>> est.score_ - np.float64(0.00672978...) + np.float64(0.00672978) >>> est.const_marginal_effect() - array([[1.008402...]]) + array([[1.008402]]) >>> est.effect() - array([1.008402...]) + array([1.008402]) >>> est.score(y, T, W=W) - np.float64(0.00310431...) + np.float64(0.00310431) >>> est.ortho_learner_model_final_.model.coef_[0] - np.float64(1.00840240...) + np.float64(1.00840240) Attributes ---------- diff --git a/econml/dml/_rlearner.py b/econml/dml/_rlearner.py index f64be2344..56234da5a 100644 --- a/econml/dml/_rlearner.py +++ b/econml/dml/_rlearner.py @@ -332,17 +332,17 @@ def _gen_rlearner_model_final(self): est.fit(y, X[:, 0], X=np.ones((X.shape[0], 1)), W=X[:, 1:]) >>> est.const_marginal_effect(np.ones((1,1))) - array([0.999631...]) + array([0.999631]) >>> est.effect(np.ones((1,1)), T0=0, T1=10) - array([9.996314...]) + array([9.996314]) >>> est.score(y, X[:, 0], X=np.ones((X.shape[0], 1)), W=X[:, 1:]) - 9.73638006...e-05 + 9.73638006e-05 >>> est.rlearner_model_final_.model LinearRegression(fit_intercept=False) >>> est.rlearner_model_final_.model.coef_ - array([0.999631...]) + array([0.999631]) >>> est.score_ - 9.82623204...e-05 + 9.82623204e-05 >>> [mdl._model for mdls in est.models_y for mdl in mdls] [LinearRegression(), LinearRegression()] >>> [mdl._model for mdls in est.models_t for mdl in mdls] diff --git a/econml/dml/causal_forest.py b/econml/dml/causal_forest.py index d6ff14eeb..b3f1688d4 100644 --- a/econml/dml/causal_forest.py +++ b/econml/dml/causal_forest.py @@ -561,10 +561,10 @@ class CausalForestDML(_BaseDML): est.fit(y, T, X=X, W=None) >>> est.effect(X[:3]) - array([0.62769..., 1.64575..., 0.68497...]) + array([0.62769, 1.64575, 0.68497]) >>> est.effect_interval(X[:3]) - (array([0.18798..., 1.17144..., 0.10788...]), - array([1.06739..., 2.12006..., 1.26205...])) + (array([0.18798, 1.17144, 0.10788]), + array([1.06739, 2.12006, 1.26205])) Attributes ---------- diff --git a/econml/dml/dml.py b/econml/dml/dml.py index 23e47f8ec..df2a59eff 100644 --- a/econml/dml/dml.py +++ b/econml/dml/dml.py @@ -500,19 +500,19 @@ class takes as input the parameter `model_t`, which is an arbitrary scikit-learn est.fit(y, T, X=X, W=None) >>> est.effect(X[:3]) - array([0.63382..., 1.78225..., 0.71859...]) + array([0.63382, 1.78225, 0.71859]) >>> est.effect_interval(X[:3]) - (array([0.27937..., 1.27619..., 0.42091...]), - array([0.98827... , 2.28831..., 1.01628...])) + (array([0.27937, 1.27619, 0.42091]), + array([0.98827 , 2.28831, 1.01628])) >>> est.coef_ - array([ 0.42857..., 0.04488..., -0.03317..., 0.02258..., -0.14875...]) + array([ 0.42857, 0.04488, -0.03317, 0.02258, -0.14875]) >>> est.coef__interval() - (array([ 0.25179..., -0.10558..., -0.16723... , -0.11916..., -0.28759...]), - array([ 0.60535..., 0.19536..., 0.10088..., 0.16434..., -0.00990...])) + (array([ 0.25179, -0.10558, -0.16723 , -0.11916, -0.28759]), + array([ 0.60535, 0.19536, 0.10088, 0.16434, -0.00990])) >>> est.intercept_ - 1.01166... + 1.01166 >>> est.intercept__interval() - (0.87125..., 1.15207...) + (0.87125, 1.15207) """ def __init__(self, *, @@ -854,19 +854,19 @@ class LinearDML(StatsModelsCateEstimatorMixin, DML): est.fit(y, T, X=X, W=None) >>> est.effect(X[:3]) - array([0.49976..., 1.91673..., 0.70800...]) + array([0.49976, 1.91673, 0.70800]) >>> est.effect_interval(X[:3]) - (array([0.15122..., 1.40182..., 0.40956...]), - array([0.84831..., 2.43164..., 1.00645...])) + (array([0.15122, 1.40182, 0.40956]), + array([0.84831, 2.43164, 1.00645])) >>> est.coef_ - array([ 0.48825..., 0.00104..., 0.00244..., 0.02217..., -0.08472...]) + array([ 0.48825, 0.00104, 0.00244, 0.02217, -0.08472]) >>> est.coef__interval() - (array([ 0.30470... , -0.13905..., -0.12789..., -0.11513..., -0.22506...]), - array([0.67180..., 0.14114..., 0.13278..., 0.15949..., 0.05561...])) + (array([ 0.30470 , -0.13905, -0.12789, -0.11513, -0.22506]), + array([0.67180, 0.14114, 0.13278, 0.15949, 0.05561])) >>> est.intercept_ - 1.01248... + 1.01248 >>> est.intercept__interval() - (0.87481..., 1.15015...) + (0.87481, 1.15015) """ def __init__(self, *, @@ -1115,19 +1115,19 @@ class SparseLinearDML(DebiasedLassoCateEstimatorMixin, DML): est.fit(y, T, X=X, W=None) >>> est.effect(X[:3]) - array([0.50083..., 1.91668..., 0.70388...]) + array([0.50083, 1.91668, 0.70388]) >>> est.effect_interval(X[:3]) - (array([0.14616..., 1.40370..., 0.40675...]), - array([0.85550..., 2.42966..., 1.00101...])) + (array([0.14616, 1.40370, 0.40675]), + array([0.85550, 2.42966, 1.00101])) >>> est.coef_ - array([ 0.49123..., 0.00493... , 0.00007..., 0.02302..., -0.08484...]) + array([ 0.49123452, 0.0049377 , 0.00007303, 0.02302108, -0.08484665]) >>> est.coef__interval() - (array([ 0.31323..., -0.13850..., -0.13720..., -0.11141..., -0.22962...]), - array([0.66923..., 0.14837..., 0.13735..., 0.15745..., 0.05992...])) + (array([ 0.31323, -0.13850, -0.13720, -0.11141, -0.22962]), + array([0.66923, 0.14837, 0.13735, 0.15745, 0.05992])) >>> est.intercept_ - 1.01477... + 1.01477 >>> est.intercept__interval() - (0.87621..., 1.15333...) + (0.87621, 1.15333) """ def __init__(self, *, @@ -1373,7 +1373,7 @@ class KernelDML(DML): est.fit(y, T, X=X, W=None) >>> est.effect(X[:3]) - array([0.63042..., 1.86101..., 0.74220...]) + array([0.63042, 1.86101, 0.74220]) """ def __init__(self, model_y='auto', model_t='auto', @@ -1597,7 +1597,7 @@ class NonParamDML(_BaseDML): est.fit(y, T, X=X, W=None) >>> est.effect(X[:3]) - array([0.35318..., 1.28760..., 0.83506...]) + array([0.35318, 1.28760, 0.83506]) """ def __init__(self, *, diff --git a/econml/dr/_drlearner.py b/econml/dr/_drlearner.py index 256680525..935b5d592 100644 --- a/econml/dr/_drlearner.py +++ b/econml/dr/_drlearner.py @@ -520,18 +520,18 @@ class takes as input the parameter ``model_regressor``, which is an arbitrary sc est.fit(y, T, X=X, W=None) >>> est.const_marginal_effect(X[:2]) - array([[0.516888..., 0.995747...], - [0.356386..., 0.671889...]]) + array([[0.516888, 0.995747], + [0.356386, 0.671889]]) >>> est.effect(X[:2], T0=0, T1=1) - array([0.516888..., 0.356386...]) + array([0.516888, 0.356386]) >>> est.score_ - np.float64(2.845660...) + np.float64(2.845660) >>> est.score(y, T, X=X) - np.float64(1.062668...) + np.float64(1.062668) >>> est.model_cate(T=1).coef_ - array([ 0.447146..., -0.001025..., 0.018984...]) + array([ 0.447146, -0.001025, 0.018984]) >>> est.model_cate(T=2).coef_ - array([ 0.925064..., -0.012351..., 0.033480...]) + array([ 0.925064, -0.012351, 0.033480]) >>> est.cate_feature_names() ['X0', 'X1', 'X2'] @@ -555,19 +555,19 @@ class takes as input the parameter ``model_regressor``, which is an arbitrary sc est.fit(y, T, X=X, W=None) >>> est.score_ - np.float64(1.73...) + np.float64(1.73) >>> est.const_marginal_effect(X[:3]) - array([[0.68..., 1.10...], - [0.56..., 0.79... ], - [0.34..., 0.10... ]]) + array([[0.68151771, 1.10936267], + [0.56679957, 0.7941794 ], + [0.34171272, 0.1045798 ]]) >>> est.model_cate(T=2).coef_ - array([0.74..., 0. , 0. ]) + array([0.74925162, 0. , 0. ]) >>> est.model_cate(T=2).intercept_ - np.float64(1.9...) + np.float64(1.9227731541272008) >>> est.model_cate(T=1).coef_ - array([0.24..., 0.00..., 0. ]) + array([0.24572861, 0.00720134, 0. ]) >>> est.model_cate(T=1).intercept_ - np.float64(0.94...) + np.float64(0.94) Attributes ---------- @@ -1245,19 +1245,19 @@ class LinearDRLearner(StatsModelsCateEstimatorDiscreteMixin, DRLearner): est.fit(y, T, X=X, W=None) >>> est.effect(X[:3]) - array([ 0.432365..., 0.359694..., -0.085428...]) + array([ 0.432365, 0.359694, -0.085428]) >>> est.effect_interval(X[:3]) - (array([ 0.084048..., -0.177951... , -0.734747...]), - array([0.780683..., 0.897341..., 0.563889...])) + (array([ 0.084048, -0.177951 , -0.734747]), + array([0.780683, 0.897341, 0.563889])) >>> est.coef_(T=1) - array([ 0.450666..., -0.008821..., 0.075271...]) + array([ 0.450666, -0.008821, 0.075271]) >>> est.coef__interval(T=1) - (array([ 0.156245..., -0.252216..., -0.159709...]), - array([0.745086..., 0.234572..., 0.310252...])) + (array([ 0.156245, -0.252216, -0.159709]), + array([0.745086, 0.234572, 0.310252])) >>> est.intercept_(T=1) - np.float64(0.909121...) + np.float64(0.909121) >>> est.intercept__interval(T=1) - (np.float64(0.668518...), np.float64(1.149723...)) + (np.float64(0.668518), np.float64(1.149723)) Attributes ---------- @@ -1582,17 +1582,17 @@ class SparseLinearDRLearner(DebiasedLassoCateEstimatorDiscreteMixin, DRLearner): est.fit(y, T, X=X, W=None) >>> est.effect(X[:3]) - array([ 0.43..., 0.35..., -0.08...]) + array([ 0.43296409, 0.35952902, -0.08460643]) >>> est.effect_interval(X[:3]) - (array([-0.01..., -0.26..., -0.81...]), array([0.87..., 0.98..., 0.65...])) + (array([-0.01363264, -0.26369244, -0.81995536]), array([0.87956083, 0.98275048, 0.65074251])) >>> est.coef_(T=1) - array([ 0.44..., -0.00..., 0.07...]) + array([ 0.44991911, -0.00881137, 0.07449517]) >>> est.coef__interval(T=1) - (array([ 0.19... , -0.24..., -0.17...]), array([0.70..., 0.22..., 0.32...])) + (array([ 0.1972161 , -0.24730627, -0.17104381]), array([0.70262212, 0.22968353, 0.32003415])) >>> est.intercept_(T=1) - np.float64(0.90...) + np.float64(0.9091174878444385) >>> est.intercept__interval(T=1) - (np.float64(0.66...), np.float64(1.14...)) + (np.float64(0.6687723462464192), np.float64(1.1494626294424575)) Attributes ---------- diff --git a/econml/grf/classes.py b/econml/grf/classes.py index 46d0a22ab..0ef703109 100644 --- a/econml/grf/classes.py +++ b/econml/grf/classes.py @@ -949,7 +949,7 @@ class RegressionForest(BaseGRF): np.set_printoptions(suppress=True) np.random.seed(123) - X, y = make_regression(n_samples=1000, n_features=4, n_informative=2, + X, y = make_regression(n_samples=1000, n_features=4, n_informative=4, random_state=0, shuffle=False) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.5) regr = RegressionForest(max_depth=None, random_state=0, @@ -958,9 +958,9 @@ class RegressionForest(BaseGRF): >>> regr.fit(X_train, y_train) RegressionForest(n_estimators=1000, random_state=0) >>> regr.feature_importances_ - array([0.88..., 0.11..., 0.00..., 0.00...]) + array([0.2869952 , 0.03651571, 0.59767877, 0.07881031]) >>> regr.predict(np.ones((1, 4)), interval=True, alpha=.05) - (array([[121.0...]]), array([[103.6...]]), array([[138.3...]])) + (array([[194.5075591]]), array([[159.10510002]]), array([[229.91001818]])) References ---------- diff --git a/econml/iv/dml/_dml.py b/econml/iv/dml/_dml.py index 12e690e34..c8f466c24 100644 --- a/econml/iv/dml/_dml.py +++ b/econml/iv/dml/_dml.py @@ -344,19 +344,19 @@ def true_heterogeneity_function(X): est.fit(Y=y, T=T, Z=Z, X=X) >>> est.effect(X[:3]) - array([-4.28039..., 6.02945..., -2.86845...]) + array([-4.28039, 6.02945, -2.86845]) >>> est.effect_interval(X[:3]) - (array([-7.20723... , 1.75413..., -5.20891...]), - array([-1.35355..., 10.30477..., -0.52799...])) + (array([-7.20723 , 1.75413, -5.20891]), + array([-1.35355, 10.30477, -0.52799])) >>> est.coef_ - array([ 4.51656..., 0.78512..., 0.23706..., 0.24127..., -0.47167...]) + array([ 4.51656, 0.78512, 0.23706, 0.24127, -0.47167]) >>> est.coef__interval() - (array([ 3.15599..., -0.35785..., -0.89798..., -0.90529..., -1.62444...]), - array([5.87712..., 1.92810..., 1.37211..., 1.38783..., 0.68110...])) + (array([ 3.15599, -0.35785, -0.89798, -0.90529, -1.62444]), + array([5.87712, 1.92810, 1.37211, 1.38783, 0.68110])) >>> est.intercept_ - -0.13668... + -0.13668 >>> est.intercept__interval() - (-1.27031..., 0.99694...) + (-1.27031, 0.99694) """ def __init__(self, *, @@ -1143,11 +1143,11 @@ def true_heterogeneity_function(X): est.fit(Y=y, T=T, Z=Z, X=X) >>> est.effect(X[:3]) - array([-3.83456..., 5.32010..., -2.78127...]) + array([-3.83456, 5.32010, -2.78127]) >>> est.coef_ - array([ 4.03977..., 0.89360..., 0.12047..., 0.37971..., -0.66072...]) + array([ 4.03977, 0.89360, 0.12047, 0.37971, -0.66072]) >>> est.intercept_ - -0.18452... + -0.18452 """ @@ -1536,7 +1536,7 @@ def true_heterogeneity_function(X): est.fit(Y=y, T=T, Z=Z, X=X) >>> est.effect(X[:3]) - array([-5.98684..., 9.03751..., -3.56817...]) + array([-5.98684, 9.03751, -3.56817]) """ diff --git a/econml/iv/dr/_dr.py b/econml/iv/dr/_dr.py index b84a79cc7..4d48ab73d 100644 --- a/econml/iv/dr/_dr.py +++ b/econml/iv/dr/_dr.py @@ -901,7 +901,7 @@ def true_heterogeneity_function(X): est.fit(Y=y, T=T, Z=Z, X=X) >>> est.effect(X[:3]) - array([-4.15076..., 5.99286..., -2.86512...]) + array([-4.15076, 5.99286, -2.86512]) """ def __init__(self, *, @@ -1390,19 +1390,19 @@ def true_heterogeneity_function(X): est.fit(Y=y, T=T, Z=Z, X=X) >>> est.effect(X[:3]) - array([-4.27796..., 5.84996..., -2.98291...]) + array([-4.27796, 5.84996, -2.98291]) >>> est.effect_interval(X[:3]) - (array([-7.16134..., 1.71884..., -5.41437...]), - array([-1.39458..., 9.98108..., -0.55145...])) + (array([-7.16134, 1.71884, -5.41437]), + array([-1.39458, 9.98108, -0.55145])) >>> est.coef_ - array([ 4.65222..., 0.93348..., 0.23315..., 0.22842..., -0.42849...]) + array([ 4.65222, 0.93348, 0.23315, 0.22842, -0.42849]) >>> est.coef__interval() - (array([ 3.40043..., -0.19165..., -0.95122... , -0.88663... , -1.56023...]), - array([5.90402..., 2.05861... , 1.41753..., 1.34348..., 0.70325...])) + (array([ 3.40043, -0.19165, -0.95122 , -0.88663 , -1.56023]), + array([5.90402, 2.05861 , 1.41753, 1.34348, 0.70325])) >>> est.intercept_ - -0.12819... + -0.12819 >>> est.intercept__interval() - (-1.27151..., 1.01512...) + (-1.27151, 1.01512) """ def __init__(self, *, @@ -1759,19 +1759,19 @@ def true_heterogeneity_function(X): est.fit(Y=y, T=T, Z=Z, X=X) >>> est.effect(X[:3]) - array([-4.23922..., 5.89221..., -3.01203...]) + array([-4.23922, 5.89221, -3.01203]) >>> est.effect_interval(X[:3]) - (array([-6.99782..., 1.96348..., -5.41958...]), - array([-1.48062..., 9.82093..., -0.60449...])) + (array([-6.99782, 1.96348, -5.41958]), + array([-1.48062, 9.82093, -0.60449])) >>> est.coef_ - array([ 4.65817..., 0.94689... , 0.18314... , 0.23012..., -0.40375...]) + array([ 4.65817, 0.94689 , 0.18314 , 0.23012, -0.40375]) >>> est.coef__interval() - (array([ 3.51645..., -0.20838..., -0.99568..., -0.89395..., -1.58517...]), - array([5.79989..., 2.10218..., 1.36197..., 1.35419..., 0.77767...])) + (array([ 3.51645, -0.20838, -0.99568, -0.89395, -1.58517]), + array([5.79989, 2.10218, 1.36197, 1.35419, 0.77767])) >>> est.intercept_ - -0.06535... + -0.06535 >>> est.intercept__interval() - (-1.20712..., 1.07641...) + (-1.20712, 1.07641) """ def __init__(self, *, @@ -2701,7 +2701,7 @@ def true_heterogeneity_function(X): est.fit(Y=y, T=T, Z=Z, X=X) >>> est.effect(X[:3]) - array([-4.52684..., 6.38767..., -2.67082...]) + array([-4.52684, 6.38767, -2.67082]) """ def __init__(self, *, @@ -3003,19 +3003,19 @@ def true_heterogeneity_function(X): est.fit(Y=y, T=T, Z=Z, X=X) >>> est.effect(X[:3]) - array([-4.80543..., 6.10553..., -2.94941...]) + array([-4.80543, 6.10553, -2.94941]) >>> est.effect_interval(X[:3]) - (array([-9.20288..., -0.47079..., -6.67443...]), - array([-0.40797..., 12.68185..., 0.77560...])) + (array([-9.20288, -0.47079, -6.67443]), + array([-0.40797, 12.68185, 0.77560])) >>> est.coef_ - array([ 5.52457..., 0.96284..., 0.68162..., -0.16799..., -0.13048...]) + array([ 5.52457, 0.96284, 0.68162, -0.16799, -0.13048]) >>> est.coef__interval() - (array([ 3.61389..., -0.81869..., -1.12607..., -1.90211..., -1.92346...]), - array([7.43525..., 2.74438..., 2.48932..., 1.56613..., 1.66248...])) + (array([ 3.61389, -0.81869, -1.12607, -1.90211, -1.92346]), + array([7.43525, 2.74438, 2.48932, 1.56613, 1.66248])) >>> est.intercept_ - -0.28950... + -0.28950 >>> est.intercept__interval() - (-2.07685..., 1.49784...) + (-2.07685, 1.49784) """ def __init__(self, *, diff --git a/econml/metalearners/_metalearners.py b/econml/metalearners/_metalearners.py index dc6d05338..d0814dc5d 100644 --- a/econml/metalearners/_metalearners.py +++ b/econml/metalearners/_metalearners.py @@ -61,7 +61,7 @@ class TLearner(TreatmentExpansionMixin, LinearCateEstimator): est.fit(y, T, X=X) >>> est.effect(X[:3]) - array([0.58547..., 1.82860..., 0.78379...]) + array([0.58547, 1.82860, 0.78379]) """ def __init__(self, *, @@ -188,7 +188,7 @@ class SLearner(TreatmentExpansionMixin, LinearCateEstimator): est.fit(y, T, X=X) >>> est.effect(X[:3]) - array([0.23577..., 1.62784... , 0.45946...]) + array([0.23577, 1.62784 , 0.45946]) """ def __init__(self, *, @@ -335,7 +335,7 @@ class XLearner(TreatmentExpansionMixin, LinearCateEstimator): est.fit(y, T, X=X) >>> est.effect(X[:3]) - array([0.58547..., 1.82860..., 0.78379...]) + array([0.58547, 1.82860, 0.78379]) """ def __init__(self, *, @@ -503,7 +503,7 @@ class DomainAdaptationLearner(TreatmentExpansionMixin, LinearCateEstimator): est.fit(y, T, X=X) >>> est.effect(X[:3]) - array([0.51237..., 1.99866..., 0.68552...]) + array([0.51237, 1.99866, 0.68552]) """ def __init__(self, *, diff --git a/econml/panel/dml/_dml.py b/econml/panel/dml/_dml.py index 93a02686b..ebb5a61a3 100644 --- a/econml/panel/dml/_dml.py +++ b/econml/panel/dml/_dml.py @@ -464,33 +464,33 @@ class DynamicDML(LinearModelFinalCateEstimatorMixin, _OrthoLearner): est.fit(y, T, X=X, W=None, groups=groups, inference="auto") >>> est.const_marginal_effect(X[:2]) - array([[-0.168..., -0.096..., -0.105..., 0.042..., -0.208..., - 0.006...], - [-0.092..., 0.326..., -0.013..., -0.237..., -0.141..., - -0.264...]]) + array([[-0.16860367, -0.09616313, -0.10517216, 0.04299467, -0.20880154, + 0.00661631], + [-0.09213123, 0.32634188, -0.01318959, -0.23741629, -0.14191649, + -0.26451663]]) >>> est.effect(X[:2], T0=0, T1=1) - array([-0.529..., -0.422...]) + array([-0.529, -0.422]) >>> est.effect(X[:2], T0=np.zeros((2, n_periods*T.shape[1])), T1=np.ones((2, n_periods*T.shape[1]))) - array([-0.529..., -0.422...]) + array([-0.529, -0.422]) >>> est.coef_ - array([[ 0.036...], - [ 0.202...], - [ 0.044...], - [-0.134...], - [ 0.032...], - [-0.130...]]) + array([[ 0.03671307], + [ 0.20283719], + [ 0.04415921], + [-0.13462035], + [ 0.03211033], + [-0.13016613]]) >>> est.coef__interval() - (array([[-0.136...], - [ 0.001...], - [-0.110...], - [-0.370...], - [-0.100...], - [-0.294...]]), array([[0.210...], - [0.404...], - [0.199...], - [0.101...], - [0.164...], - [0.034...]])) + (array([[-0.13693069], + [ 0.00118659], + [-0.11086215], + [-0.37026662], + [-0.10044078], + [-0.29480958]]), array([[0.21035682], + [0.40448779], + [0.19918057], + [0.10102593], + [0.16466144], + [0.03447732]])) """ def __init__(self, *,