Skip to content

Commit

Permalink
Merge pull request #6 from haraoka-screen/rename_method2
Browse files Browse the repository at this point in the history
Modify method name
  • Loading branch information
ikeuchi-screen authored Jan 24, 2024
2 parents e4be728 + 0bd27a1 commit 720f540
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ print(model.costs_)
print(model.is_stables_)

# effects of causal effects
print(model.estimates_causal_effects(1))
print(model.estimate_causal_effects(1))
```

## Example
Expand Down
16 changes: 8 additions & 8 deletions examples/lingd.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"</svg>\n"
],
"text/plain": [
"<graphviz.sources.Source at 0x7fbda6c69fd0>"
"<graphviz.sources.Source at 0x7fda6b02bfd0>"
]
},
"metadata": {},
Expand Down Expand Up @@ -241,7 +241,7 @@
{
"data": {
"text/plain": [
"<lingd.lingd.LiNGD at 0x7fbda6c6c3d0>"
"<lingd.lingd.LiNGD at 0x7fda6b02b3a0>"
]
},
"execution_count": 4,
Expand Down Expand Up @@ -365,7 +365,7 @@
"</svg>\n"
],
"text/plain": [
"<graphviz.sources.Source at 0x7fbda6c6c340>"
"<graphviz.sources.Source at 0x7fdaad0825e0>"
]
},
"metadata": {},
Expand Down Expand Up @@ -496,7 +496,7 @@
"</svg>\n"
],
"text/plain": [
"<graphviz.sources.Source at 0x7fbdb90346a0>"
"<graphviz.sources.Source at 0x7fda7b1dc1c0>"
]
},
"metadata": {},
Expand Down Expand Up @@ -599,7 +599,7 @@
"</svg>\n"
],
"text/plain": [
"<graphviz.sources.Source at 0x7fbdb8faf340>"
"<graphviz.sources.Source at 0x7fda7b1dc1c0>"
]
},
"metadata": {},
Expand Down Expand Up @@ -724,7 +724,7 @@
"</svg>\n"
],
"text/plain": [
"<graphviz.sources.Source at 0x7fbda6c48ca0>"
"<graphviz.sources.Source at 0x7fda7b2e40a0>"
]
},
"metadata": {},
Expand Down Expand Up @@ -756,7 +756,7 @@
"source": [
"# Estimating effects of causal effect\n",
"\n",
"estimates_causal_effects(target_index) calculates the difference between an intervention with 1 and an intervention with 0 in the target_index variable."
"estimate_causal_effects(target_index) calculates the difference between an intervention with 1 and an intervention with 0 in the target_index variable."
]
},
{
Expand All @@ -767,7 +767,7 @@
"outputs": [],
"source": [
"# the intervention target is x2.\n",
"effects = model.estimates_causal_effects(1)"
"effects = model.estimate_causal_effects(1)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion lingd/lingd.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def fit(self, X):

return self

def estimates_causal_effects(self, target_index):
def estimate_causal_effects(self, target_index):
"""
This method estimates causal effects from target_index to each feature.
Expand Down
10 changes: 5 additions & 5 deletions tests/test_lingd.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_properties_exception(init):
model = LiNGD()

try:
model.estimates_causal_effects(0)
model.estimate_causal_effects(0)
except RuntimeError:
pass
else:
Expand All @@ -136,22 +136,22 @@ def test_properties_exception(init):
else:
raise AssertionError

def test_estimates_causal_effects_success(init, test_data):
def test_estimate_causal_effects_success(init, test_data):
init()

X = test_data

k = 10
model = LiNGD(k=k)
model.fit(X)
effects = model.estimates_causal_effects(1)
effects = model.estimate_causal_effects(1)

assert len(effects) == k

for effect in effects:
assert len(effect) == X.shape[1]

def test_estimates_causal_effects_exception(init, test_data):
def test_estimate_causal_effects_exception(init, test_data):
init()

X = test_data
Expand All @@ -160,7 +160,7 @@ def test_estimates_causal_effects_exception(init, test_data):
model.fit(X)

try:
effects = model.estimates_causal_effects(-1)
effects = model.estimate_causal_effects(-1)
except ValueError:
pass
else:
Expand Down

0 comments on commit 720f540

Please sign in to comment.