Skip to content

Commit

Permalink
Add GC collections
Browse files Browse the repository at this point in the history
  • Loading branch information
kbattocchi committed Apr 5, 2022
1 parent 96d7292 commit 6e7e131
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions econml/tests/test_causal_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from numpy.core.fromnumeric import squeeze
import pandas as pd
import pytest
import gc

from econml.solutions.causal_analysis import CausalAnalysis
from econml.solutions.causal_analysis._causal_analysis import _CausalInsightsConstants
Expand Down Expand Up @@ -692,6 +693,9 @@ def test_random_state(self):
np.testing.assert_equal(glo.point.values, glo2.point.values)
np.testing.assert_equal(glo.stderr.values, glo2.stderr.values)

del ca, glo, ca2, glo
gc.collect()

def test_can_set_categories(self):
y = pd.Series(np.random.choice([0, 1], size=(500,)))
X = pd.DataFrame({'a': np.random.normal(size=500),
Expand Down Expand Up @@ -785,6 +789,9 @@ def test_invalid_inds(self):
self.assertEqual(ca.untrained_feature_indices_, [(4, 'cat_limit'),
(5, 'cat_limit')])

del ca
gc.collect()

# Add tests that guarantee that the reliance on DML feature order is not broken, such as
# Creare a transformer that zeros out all variables after the first n_x variables, so it zeros out W
# Pass an example where W is irrelevant and X is confounder
Expand Down

0 comments on commit 6e7e131

Please sign in to comment.