From f8aa15049638597442ab73cdafcf17b2dfbd3724 Mon Sep 17 00:00:00 2001 From: Jeong-Yoon Lee Date: Wed, 31 Jul 2024 18:52:12 -0700 Subject: [PATCH] fix lint errors --- causalml/inference/meta/rlearner.py | 7 +++++-- causalml/metrics/visualize.py | 4 +++- causalml/propensity.py | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/causalml/inference/meta/rlearner.py b/causalml/inference/meta/rlearner.py index f320278d..dacfa64e 100644 --- a/causalml/inference/meta/rlearner.py +++ b/causalml/inference/meta/rlearner.py @@ -667,14 +667,17 @@ def fit(self, X, treatment, y, p=None, sample_weight=None, verbose=True): self.models_tau[group].fit( X=X_train_filt, y=(y_train_filt - yhat_train_filt) / (w_train - p_train_filt), - sample_weight=sample_weight_train_filt * ((w_train - p_train_filt) ** 2), + sample_weight=sample_weight_train_filt + * ((w_train - p_train_filt) ** 2), eval_set=[ ( X_test_filt, (y_test_filt - yhat_test_filt) / (w_test - p_test_filt), ) ], - sample_weight_eval_set=[sample_weight_test_filt * ((w_test - p_test_filt) ** 2)], + sample_weight_eval_set=[ + sample_weight_test_filt * ((w_test - p_test_filt) ** 2) + ], verbose=verbose, ) diff --git a/causalml/metrics/visualize.py b/causalml/metrics/visualize.py index 669f4cbe..8d6b4a61 100644 --- a/causalml/metrics/visualize.py +++ b/causalml/metrics/visualize.py @@ -640,7 +640,9 @@ def plot_qini( def plot_tmlegain( df, inference_col, - learner=LGBMRegressor(num_leaves=64, learning_rate=0.05, n_estimators=300, verbose=-1), + learner=LGBMRegressor( + num_leaves=64, learning_rate=0.05, n_estimators=300, verbose=-1 + ), outcome_col="y", treatment_col="w", p_col="tau", diff --git a/causalml/propensity.py b/causalml/propensity.py index a3761942..f3aee9e3 100644 --- a/causalml/propensity.py +++ b/causalml/propensity.py @@ -115,7 +115,9 @@ class GradientBoostedPropensityModel(PropensityModel): def __init__(self, early_stop=False, clip_bounds=(1e-3, 1 - 1e-3), **model_kwargs): self.early_stop = early_stop - super(GradientBoostedPropensityModel, self).__init__(clip_bounds, **model_kwargs) + super(GradientBoostedPropensityModel, self).__init__( + clip_bounds, **model_kwargs + ) @property def _model(self):