Skip to content

Commit b3c00e4

Browse files
drbenvincentarthurmello
authored andcommitted
Merge pull request pymc-labs#404 from pymc-labs/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2 parents 4b0fcef + c8904f3 commit b3c00e4

File tree

4 files changed

+241
-4
lines changed

4 files changed

+241
-4
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repos:
2525
exclude: &exclude_pattern 'iv_weak_instruments.ipynb'
2626
args: ["--maxkb=1500"]
2727
- repo: https://github.com/astral-sh/ruff-pre-commit
28-
rev: v0.6.2
28+
rev: v0.6.3
2929
hooks:
3030
# Run the linter
3131
- id: ruff
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
date,twitter,linkedin,tiktok,instagram
2+
2022-05-15,55,9,23,59
3+
2022-05-16,54,18,20,59
4+
2022-05-17,54,20,23,57
5+
2022-05-18,54,20,21,55
6+
2022-05-19,49,23,21,52
7+
2022-05-20,46,18,22,56
8+
2022-05-21,51,9,23,58
9+
2022-05-22,47,9,27,59
10+
2022-05-23,45,19,21,58
11+
2022-05-24,49,21,23,53
12+
2022-05-25,55,21,21,61
13+
2022-05-26,53,19,22,68
14+
2022-05-27,52,16,23,52
15+
2022-05-28,46,8,24,59
16+
2022-05-29,45,7,22,56
17+
2022-05-30,45,9,24,61
18+
2022-05-31,46,19,20,58
19+
2022-06-01,51,21,22,56
20+
2022-06-02,47,19,22,54
21+
2022-06-03,46,17,21,56
22+
2022-06-04,45,9,23,58
23+
2022-06-05,47,9,23,60
24+
2022-06-06,48,20,21,58
25+
2022-06-07,46,23,21,57
26+
2022-06-08,48,22,24,56
27+
2022-06-09,48,20,23,55
28+
2022-06-10,48,17,22,56
29+
2022-06-11,47,9,25,54
30+
2022-06-12,46,9,24,56
31+
2022-06-13,46,20,22,54
32+
2022-06-14,46,21,23,58
33+
2022-06-15,47,21,23,58
34+
2022-06-16,46,21,24,56
35+
2022-06-17,51,17,23,57
36+
2022-06-18,44,9,24,54
37+
2022-06-19,43,8,26,59
38+
2022-06-20,45,16,25,53
39+
2022-06-21,53,23,24,56
40+
2022-06-22,48,21,25,58
41+
2022-06-23,48,22,26,55
42+
2022-06-24,54,18,24,56
43+
2022-06-25,54,9,25,57
44+
2022-06-26,48,8,23,62
45+
2022-06-27,51,19,24,58
46+
2022-06-28,54,21,25,56
47+
2022-06-29,49,20,25,61
48+
2022-06-30,53,19,27,58
49+
2022-07-01,56,17,26,55
50+
2022-07-02,47,8,25,56
51+
2022-07-03,49,8,28,58
52+
2022-07-04,47,9,25,58
53+
2022-07-05,52,20,22,61
54+
2022-07-06,49,20,27,60
55+
2022-07-07,49,21,26,56
56+
2022-07-08,58,17,27,53
57+
2022-07-09,61,10,30,55
58+
2022-07-10,56,15,31,55
59+
2022-07-11,59,27,27,55
60+
2022-07-12,52,25,28,57
61+
2022-07-13,54,25,26,55
62+
2022-07-14,61,25,25,60
63+
2022-07-15,51,22,25,58
64+
2022-07-16,50,12,24,58
65+
2022-07-17,53,13,28,57
66+
2022-07-18,48,24,25,57
67+
2022-07-19,50,26,25,57
68+
2022-07-20,47,26,25,53
69+
2022-07-21,49,24,26,55
70+
2022-07-22,50,21,26,57
71+
2022-07-23,47,9,26,55
72+
2022-07-24,45,8,27,57
73+
2022-07-25,47,19,26,59
74+
2022-07-26,47,20,28,58
75+
2022-07-27,47,20,27,56
76+
2022-07-28,48,19,26,57
77+
2022-07-29,47,18,27,58
78+
2022-07-30,46,9,28,53
79+
2022-07-31,48,9,27,58
80+
2022-08-01,48,19,25,56
81+
2022-08-02,51,21,25,56
82+
2022-08-03,49,21,27,55
83+
2022-08-04,47,20,24,54
84+
2022-08-05,47,17,25,54
85+
2022-08-06,47,10,26,57
86+
2022-08-07,46,9,26,58
87+
2022-08-08,46,19,24,59
88+
2022-08-09,62,21,25,59
89+
2022-08-10,52,20,25,56
90+
2022-08-11,54,21,24,61
91+
2022-08-12,60,18,24,59
92+
2022-08-13,55,9,26,56
93+
2022-08-14,52,9,25,55
94+
2022-08-15,48,19,24,54
95+
2022-08-16,49,21,27,55
96+
2022-08-17,47,20,24,53
97+
2022-08-18,45,19,24,53
98+
2022-08-19,47,18,25,53
99+
2022-08-20,47,9,25,54
100+
2022-08-21,49,10,27,56
101+
2022-08-22,44,20,23,55
102+
2022-08-23,46,22,23,52
103+
2022-08-24,49,22,23,52
104+
2022-08-25,47,21,23,56
105+
2022-08-26,56,17,23,54
106+
2022-08-27,52,9,25,55
107+
2022-08-28,51,9,26,57
108+
2022-08-29,47,19,22,56
109+
2022-08-30,47,21,22,52
110+
2022-08-31,46,20,21,52
111+
2022-09-01,47,18,22,55
112+
2022-09-02,48,16,21,49
113+
2022-09-03,50,8,24,52
114+
2022-09-04,47,8,25,56
115+
2022-09-05,48,10,27,56
116+
2022-09-06,45,19,24,54
117+
2022-09-07,49,20,21,54
118+
2022-09-08,51,19,23,50
119+
2022-09-09,49,16,21,52
120+
2022-09-10,49,9,21,52
121+
2022-09-11,52,9,22,55
122+
2022-09-12,49,19,21,50
123+
2022-09-13,54,21,20,52
124+
2022-09-14,47,21,20,49
125+
2022-09-15,45,20,30,51
126+
2022-09-16,42,16,22,48
127+
2022-09-17,47,9,23,52
128+
2022-09-18,50,9,23,51
129+
2022-09-19,48,20,21,48
130+
2022-09-20,47,21,22,50
131+
2022-09-21,47,22,23,51
132+
2022-09-22,46,21,23,55
133+
2022-09-23,46,18,21,49
134+
2022-09-24,47,9,22,50
135+
2022-09-25,48,9,23,53
136+
2022-09-26,45,17,23,51
137+
2022-09-27,46,20,23,47
138+
2022-09-28,49,19,23,50
139+
2022-09-29,45,18,30,56
140+
2022-09-30,49,17,32,56
141+
2022-10-01,47,9,36,64
142+
2022-10-02,52,9,39,66
143+
2022-10-03,53,19,31,60
144+
2022-10-04,64,21,33,66
145+
2022-10-05,58,20,34,68
146+
2022-10-06,49,19,33,62
147+
2022-10-07,51,17,22,49
148+
2022-10-08,50,9,24,48
149+
2022-10-09,52,9,22,52
150+
2022-10-10,52,16,21,50
151+
2022-10-11,51,20,22,50
152+
2022-10-12,47,19,22,49
153+
2022-10-13,46,20,23,48
154+
2022-10-14,46,18,20,49
155+
2022-10-15,49,9,22,48
156+
2022-10-16,52,9,23,52
157+
2022-10-17,47,19,22,52
158+
2022-10-18,48,20,24,49
159+
2022-10-19,46,19,24,50
160+
2022-10-20,46,20,22,49
161+
2022-10-21,49,18,22,47
162+
2022-10-22,50,9,23,49
163+
2022-10-23,58,8,22,53
164+
2022-10-24,53,18,22,50
165+
2022-10-25,53,21,22,50
166+
2022-10-26,52,19,22,49
167+
2022-10-27,56,19,28,49
168+
2022-10-28,100,17,26,48
169+
2022-10-29,75,8,25,49
170+
2022-10-30,66,9,23,56
171+
2022-10-31,69,17,21,83
172+
2022-11-01,75,19,21,58
173+
2022-11-02,64,21,23,51
174+
2022-11-03,61,19,24,49
175+
2022-11-04,76,17,28,52
176+
2022-11-05,69,9,23,54
177+
2022-11-06,62,8,25,51
178+
2022-11-07,66,18,23,50
179+
2022-11-08,60,18,24,47
180+
2022-11-09,64,18,21,45
181+
2022-11-10,61,19,22,49
182+
2022-11-11,69,16,23,47

causalpy/tests/test_api_stability.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright 2024 The PyMC Labs Developers
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
"""
15+
Tests API stability for specific external calls
16+
"""
17+
18+
import matplotlib.pyplot as plt
19+
import pandas as pd
20+
21+
import causalpy as cp
22+
from causalpy.experiments.prepostfit import SyntheticControl
23+
from causalpy.pymc_models import WeightedSumFitter
24+
25+
26+
def test_causal_inference_and_discovery_with_python_example():
27+
"""Test example used in Alexander Molak's book 'Causal Inference and Discovery in Python'
28+
Chapter 11 (pages 304-307)
29+
"""
30+
data = pd.read_csv(r"./causalpy/data/gt_social_media_data.csv")
31+
data.index = pd.to_datetime(data["date"])
32+
data = data.drop("date", axis=1)
33+
treatment_index = pd.to_datetime("2022-10-28")
34+
35+
# Build the model
36+
model = cp.pymc_models.WeightedSumFitter()
37+
assert isinstance(
38+
model, WeightedSumFitter
39+
), "model is not an instance of WeightedSumFitter"
40+
41+
formula = "twitter ~ 0 + tiktok + linkedin + instagram"
42+
43+
# Run the experiment and plot results
44+
results = cp.pymc_experiments.SyntheticControl(
45+
data,
46+
treatment_index,
47+
formula=formula,
48+
model=model,
49+
)
50+
assert isinstance(
51+
results, SyntheticControl
52+
), "results is not an instance of SyntheticControl"
53+
54+
fig, ax = results.plot()
55+
assert isinstance(fig, plt.Figure)

docs/source/_static/interrogate_badge.svg

Lines changed: 3 additions & 3 deletions
Loading

0 commit comments

Comments
 (0)