Skip to content

Commit d98e6dd

Browse files
authored
Merge pull request #148 from DoubleML/m-pep8
Fix some pep8 issues
2 parents 86ef75c + 44fde01 commit d98e6dd

File tree

7 files changed

+17
-15
lines changed

7 files changed

+17
-15
lines changed

doubleml/double_ml_pliv.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ def _nuisance_tuning(self, smpls, param_grids, scoring_methods, n_folds_tune, n_
270270
search_mode, n_iter_randomized_search):
271271
if self.partialX & (not self.partialZ):
272272
res = self._nuisance_tuning_partial_x(smpls, param_grids, scoring_methods, n_folds_tune, n_jobs_cv,
273-
search_mode, n_iter_randomized_search)
273+
search_mode, n_iter_randomized_search)
274274
elif (not self.partialX) & self.partialZ:
275275
res = self._nuisance_tuning_partial_z(smpls, param_grids, scoring_methods, n_folds_tune, n_jobs_cv,
276-
search_mode, n_iter_randomized_search)
276+
search_mode, n_iter_randomized_search)
277277
else:
278278
assert (self.partialX & self.partialZ)
279279
res = self._nuisance_tuning_partial_xz(smpls, param_grids, scoring_methods, n_folds_tune, n_jobs_cv,
280-
search_mode, n_iter_randomized_search)
280+
search_mode, n_iter_randomized_search)
281281

282282
return res
283283

@@ -424,7 +424,7 @@ def _nuisance_est_partial_xz(self, smpls, n_jobs_cv):
424424
return psi_a, psi_b, preds
425425

426426
def _nuisance_tuning_partial_x(self, smpls, param_grids, scoring_methods, n_folds_tune, n_jobs_cv,
427-
search_mode, n_iter_randomized_search):
427+
search_mode, n_iter_randomized_search):
428428
x, y = check_X_y(self._dml_data.x, self._dml_data.y,
429429
force_all_finite=False)
430430
x, d = check_X_y(x, self._dml_data.d,
@@ -487,7 +487,7 @@ def _nuisance_tuning_partial_x(self, smpls, param_grids, scoring_methods, n_fold
487487
return res
488488

489489
def _nuisance_tuning_partial_z(self, smpls, param_grids, scoring_methods, n_folds_tune, n_jobs_cv,
490-
search_mode, n_iter_randomized_search):
490+
search_mode, n_iter_randomized_search):
491491
xz, d = check_X_y(np.hstack((self._dml_data.x, self._dml_data.z)),
492492
self._dml_data.d,
493493
force_all_finite=False)
@@ -512,7 +512,7 @@ def _nuisance_tuning_partial_z(self, smpls, param_grids, scoring_methods, n_fold
512512
return res
513513

514514
def _nuisance_tuning_partial_xz(self, smpls, param_grids, scoring_methods, n_folds_tune, n_jobs_cv,
515-
search_mode, n_iter_randomized_search):
515+
search_mode, n_iter_randomized_search):
516516
x, y = check_X_y(self._dml_data.x, self._dml_data.y,
517517
force_all_finite=False)
518518
xz, d = check_X_y(np.hstack((self._dml_data.x, self._dml_data.z)),

doubleml/tests/_utils_iivm_manual.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ def fit_nuisance_iivm(y, x, d, z, learner_g, learner_m, learner_r, smpls,
6161
train_cond0 = np.where(z == 0)[0]
6262
if is_classifier(learner_g):
6363
g_hat0_list = fit_predict_proba(y, x, ml_g0, g0_params, smpls,
64-
train_cond=train_cond0)
64+
train_cond=train_cond0)
6565
else:
6666
g_hat0_list = fit_predict(y, x, ml_g0, g0_params, smpls,
67-
train_cond=train_cond0)
67+
train_cond=train_cond0)
6868

6969
ml_g1 = clone(learner_g)
7070
train_cond1 = np.where(z == 1)[0]

doubleml/tests/_utils_irm_manual.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,19 @@ def fit_nuisance_irm(y, x, d, learner_g, learner_m, smpls, score,
5959
train_cond0 = np.where(d == 0)[0]
6060
if is_classifier(learner_g):
6161
g_hat0_list = fit_predict_proba(y, x, ml_g0, g0_params, smpls,
62-
train_cond=train_cond0)
62+
train_cond=train_cond0)
6363
else:
6464
g_hat0_list = fit_predict(y, x, ml_g0, g0_params, smpls,
65-
train_cond=train_cond0)
65+
train_cond=train_cond0)
6666

6767
if score == 'ATE':
6868
train_cond1 = np.where(d == 1)[0]
6969
if is_classifier(learner_g):
7070
g_hat1_list = fit_predict_proba(y, x, ml_g1, g1_params, smpls,
71-
train_cond=train_cond1)
71+
train_cond=train_cond1)
7272
else:
7373
g_hat1_list = fit_predict(y, x, ml_g1, g1_params, smpls,
74-
train_cond=train_cond1)
74+
train_cond=train_cond1)
7575
else:
7676
assert score == 'ATTE'
7777
g_hat1_list = list()

doubleml/tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ def generate_data_iivm_binary(request):
214214
prz = 1 / (1 + np.exp((-1) * (x[:, 0] * (-1) * b[4] + x[:, 1] * b[2] + np.random.standard_normal(size=[n, ]))))
215215
z = np.random.binomial(p=prz, n=1, size=[n, ])
216216
u = np.random.standard_normal(size=[n, ])
217-
pr = 1 / (1 + np.exp((-1) * (0.5 * z + x[:, 0] * (-0.5) + x[:, 1] * 0.25 - 0.5 * u + np.random.standard_normal(size=[n, ]))))
217+
pr = 1 / (1 + np.exp((-1) * (0.5 * z + x[:, 0] * (-0.5) + x[:, 1] * 0.25 - 0.5 * u
218+
+ np.random.standard_normal(size=[n, ]))))
218219
d = np.random.binomial(p=pr, n=1, size=[n, ])
219220
err = np.random.standard_normal(n)
220221

doubleml/tests/test_dml_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def test_disjoint_sets():
398398
msg = (r'At least one variable/column is set as instrumental variable \(``z_cols``\) and cluster variable in '
399399
'``cluster_cols``.')
400400
with pytest.raises(ValueError, match=msg):
401-
_ = DoubleMLClusterData(df, y_col='yy', d_cols=['dd1'], x_cols=['xx1'], z_cols = ['xx2'], cluster_cols='xx2')
401+
_ = DoubleMLClusterData(df, y_col='yy', d_cols=['dd1'], x_cols=['xx1'], z_cols=['xx2'], cluster_cols='xx2')
402402

403403

404404
@pytest.mark.ci

doubleml/tests/test_iivm_classifier.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def dml_iivm_classifier_fixture(generate_data_iivm_binary, learner, score, dml_p
5555
ml_r = clone(learner[1])
5656

5757
np.random.seed(3141)
58-
obj_dml_data = dml.DoubleMLData.from_arrays(x, y, d, z)
58+
obj_dml_data = dml.DoubleMLData.from_arrays(x, y, d, z)
5959
dml_iivm_obj = dml.DoubleMLIIVM(obj_dml_data,
6060
ml_g, ml_m, ml_r,
6161
n_folds,

doubleml/tests/test_irm_classifier.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from ._utils import draw_smpls
1414
from ._utils_irm_manual import fit_irm, boot_irm
1515

16+
1617
@pytest.fixture(scope='module',
1718
params=[[LogisticRegression(solver='lbfgs', max_iter=250),
1819
LogisticRegression(solver='lbfgs', max_iter=250)],

0 commit comments

Comments
 (0)