Skip to content

Commit 76b477c

Browse files
committed
Merge remote-tracking branch 'origin/main' into cetagostini/working_on_placebos
2 parents 3cc0fc2 + 835ef41 commit 76b477c

9 files changed

Lines changed: 17 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ jobs:
2626
python-version: "3.12"
2727
- name: Run prek on changed files in PRs
2828
if: github.event_name == 'pull_request'
29-
uses: j178/prek-action@53276d8b0d10f8b6672aa85b4588c6921d0370cc # v2.0.1
29+
uses: j178/prek-action@cbc2f23eb5539cf20d82d1aabd0d0ecbcc56f4e3 # v2.0.2
3030
with:
3131
extra-args: --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
3232
- name: Run prek on all files on pushes
3333
if: github.event_name != 'pull_request'
34-
uses: j178/prek-action@53276d8b0d10f8b6672aa85b4588c6921d0370cc # v2.0.1
34+
uses: j178/prek-action@cbc2f23eb5539cf20d82d1aabd0d0ecbcc56f4e3 # v2.0.2
3535
with:
3636
extra-args: --all-files
3737

.github/workflows/interrogate-badge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Generate badge
2929
run: interrogate causalpy/ --generate-badge . --badge-format svg
3030

31-
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
31+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
3232
with:
3333
name: interrogate-badge
3434
path: interrogate_badge.svg

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
env:
5555
REF_NAME: ${{ github.ref_name }}
5656
REF_TYPE: ${{ github.ref_type }}
57-
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
57+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
5858
with:
5959
name: artifact
6060
path: dist/*
@@ -71,7 +71,7 @@ jobs:
7171
with:
7272
name: artifact
7373
path: dist
74-
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
74+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
7575
with:
7676
skip_existing: true
7777
repository_url: https://test.pypi.org/legacy/
@@ -103,4 +103,4 @@ jobs:
103103
with:
104104
name: artifact
105105
path: dist
106-
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
106+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0

.github/workflows/welcome.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
# FIRST_TIME_CONTRIBUTOR: contributed elsewhere but not to this repo
5151
- name: Add first-time-contributor label
5252
if: github.event_name == 'pull_request_target' && (github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' || github.event.pull_request.author_association == 'FIRST_TIMER')
53-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
53+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
5454
with:
5555
script: |
5656
await github.rest.issues.addLabels({

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ repos:
3030
- id: check-case-conflict
3131
- id: mixed-line-ending
3232
- repo: https://github.com/astral-sh/ruff-pre-commit
33-
rev: v0.15.10
33+
rev: v0.15.11
3434
hooks:
3535
# Run the linter
3636
- id: ruff

causalpy/experiments/panel_regression.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ def get_plot_data_bayesian(self, **kwargs: Any) -> pd.DataFrame:
557557
"""
558558
# Get posterior predictions
559559
if isinstance(self.model, PyMCModel):
560-
mu = self.model.idata.posterior["mu"] # type: ignore[attr-defined]
560+
mu = self.model.idata.posterior["mu"] # type: ignore[union-attr]
561561
pred_mean = mu.mean(dim=["chain", "draw"]).values.flatten()
562562
pred_lower = mu.quantile(0.025, dim=["chain", "draw"]).values.flatten()
563563
pred_upper = mu.quantile(0.975, dim=["chain", "draw"]).values.flatten()
@@ -673,14 +673,17 @@ def plot_unit_effects(
673673

674674
if isinstance(self.model, PyMCModel):
675675
# Bayesian: get posterior means
676-
beta = self.model.idata.posterior["beta"] # type: ignore[attr-defined]
676+
beta = self.model.idata.posterior["beta"] # type: ignore[union-attr]
677677
unit_fe_indices = [self.labels.index(name) for name in unit_fe_names]
678678

679679
# Get mean and std for each unit FE
680680
fe_means = []
681681
for idx in unit_fe_indices:
682682
fe_means.append(
683-
float(beta.sel(coeffs=self.labels[idx]).mean(dim=["chain", "draw"]))
683+
beta.sel(coeffs=self.labels[idx])
684+
.mean(dim=["chain", "draw"])
685+
.squeeze("treated_units", drop=True)
686+
.item()
684687
)
685688

686689
ax.hist(

causalpy/tests/test_panel_regression.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ def test_panel_regression_plot_coefficients(mock_pymc_sample, small_panel_data):
290290

291291

292292
@pytest.mark.integration
293+
@pytest.mark.filterwarnings(
294+
"error:Conversion of an array with ndim > 0 to a scalar:DeprecationWarning"
295+
)
293296
def test_panel_regression_plot_unit_effects(mock_pymc_sample, small_panel_data):
294297
"""Test plot_unit_effects method."""
295298
result = cp.PanelRegression(

docs/source/_static/classes.png

389 KB
Loading

docs/source/_static/packages.png

67 KB
Loading

0 commit comments

Comments
 (0)