Skip to content

Commit bd32e1a

Browse files
committed
linter
1 parent 508244b commit bd32e1a

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

causal_testing/testing/estimators.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging
44
from abc import ABC, abstractmethod
55
from typing import Any
6+
from math import ceil
67

78
import numpy as np
89
import pandas as pd
@@ -16,7 +17,6 @@
1617
from statsmodels.tools.sm_exceptions import PerfectSeparationError
1718

1819
from causal_testing.specification.variable import Variable
19-
from math import ceil
2020

2121
logger = logging.getLogger(__name__)
2222

@@ -116,7 +116,6 @@ def __init__(
116116
effect_modifiers = []
117117

118118
if formula is not None:
119-
# TODO: validate it
120119
self.formula = formula
121120
else:
122121
terms = [treatment] + sorted(list(adjustment_set)) + sorted(list(effect_modifiers))
@@ -158,13 +157,11 @@ def _run_logistic_regression(self, data) -> RegressionResultsWrapper:
158157
cols = [self.treatment]
159158
cols += [x for x in self.adjustment_set if x not in cols]
160159
treatment_and_adjustments_cols = reduced_df[cols + ["Intercept"]]
161-
outcome_col = reduced_df[[self.outcome]]
162160
for col in treatment_and_adjustments_cols:
163161
if str(treatment_and_adjustments_cols.dtypes[col]) == "object":
164162
treatment_and_adjustments_cols = pd.get_dummies(
165163
treatment_and_adjustments_cols, columns=[col], drop_first=True
166164
)
167-
# regression = sm.Logit(outcome_col, treatment_and_adjustments_cols) # This one works
168165
model = smf.logit(formula=self.formula, data=data).fit(disp=0)
169166
return model
170167

@@ -322,7 +319,6 @@ def __init__(
322319
effect_modifiers = []
323320

324321
if formula is not None:
325-
# TODO: validate it
326322
self.formula = formula
327323
else:
328324
terms = [treatment] + sorted(list(adjustment_set)) + sorted(list(effect_modifiers))
@@ -485,13 +481,11 @@ def _run_linear_regression(self) -> RegressionResultsWrapper:
485481
cols = [self.treatment]
486482
cols += [x for x in self.adjustment_set if x not in cols]
487483
treatment_and_adjustments_cols = reduced_df[cols + ["Intercept"]]
488-
outcome_col = reduced_df[[self.outcome]]
489484
for col in treatment_and_adjustments_cols:
490485
if str(treatment_and_adjustments_cols.dtypes[col]) == "object":
491486
treatment_and_adjustments_cols = pd.get_dummies(
492487
treatment_and_adjustments_cols, columns=[col], drop_first=True
493488
)
494-
# model = sm.OLS(outcome_col, treatment_and_adjustments_cols).fit()
495489
model = smf.ols(formula=self.formula, data=self.df).fit()
496490
return model
497491

0 commit comments

Comments
 (0)