Skip to content

Commit c080fa9

Browse files
committed
remove PlotComponent abstract base class
1 parent 70e58f8 commit c080fa9

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

causalpy/plotting.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
from abc import ABC
1514

1615
import arviz as az
1716
import matplotlib.pyplot as plt
@@ -25,13 +24,7 @@
2524
az.style.use("arviz-darkgrid")
2625

2726

28-
class PlotComponent(ABC):
29-
"""Abstract Base Class for PlotComponent."""
30-
31-
pass
32-
33-
34-
class BayesianPlotComponent(PlotComponent):
27+
class BayesianPlotComponent:
3528
"""Plotting component for Bayesian models."""
3629

3730
@staticmethod
@@ -443,7 +436,7 @@ def plot_regression_kink(results, round_to=None):
443436
return fig, ax
444437

445438

446-
class OLSPlotComponent(PlotComponent):
439+
class OLSPlotComponent:
447440
"""Plotting component for OLS models."""
448441

449442
@staticmethod

causalpy/pymc_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import xarray as xr
2424
from arviz import r2_score
2525

26-
from causalpy.plotting import BayesianPlotComponent, PlotComponent
26+
from causalpy.plotting import BayesianPlotComponent
2727
from causalpy.utils import round_num
2828

2929

@@ -159,7 +159,7 @@ def calculate_impact(self, y_true, y_pred):
159159
def calculate_cumulative_impact(self, impact):
160160
return impact.cumsum(dim="obs_ind")
161161

162-
def get_plot_component(self) -> PlotComponent:
162+
def get_plot_component(self) -> BayesianPlotComponent:
163163
return BayesianPlotComponent()
164164

165165
def print_coefficients(self, labels, round_to=None) -> None:

causalpy/skl_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from sklearn.linear_model import LinearRegression
2222
from sklearn.linear_model._base import LinearModel
2323

24-
from causalpy.plotting import OLSPlotComponent, PlotComponent
24+
from causalpy.plotting import OLSPlotComponent
2525
from causalpy.utils import round_num
2626

2727

@@ -36,7 +36,7 @@ def calculate_cumulative_impact(self, impact):
3636
"""Calculate the cumulative impact intervention."""
3737
return np.cumsum(impact)
3838

39-
def get_plot_component(self) -> PlotComponent:
39+
def get_plot_component(self) -> OLSPlotComponent:
4040
"""Get the plot component type for the model."""
4141
return OLSPlotComponent()
4242

docs/source/_static/classes.png

-11.5 KB
Loading

0 commit comments

Comments
 (0)