Skip to content

Commit

Permalink
Merge branch '292-graphing-quantile-probability-plot' into add-hssm-link
Browse files Browse the repository at this point in the history
  • Loading branch information
digicosmos86 committed Nov 14, 2023
2 parents 5bc47f6 + 0fe530c commit 8772a69
Show file tree
Hide file tree
Showing 7 changed files with 258 additions and 259 deletions.
488 changes: 243 additions & 245 deletions docs/tutorials/plotting.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/hssm/distribution_utils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import logging
from os import PathLike
from typing import Any, Callable, Iterable, Type
from typing import Any, Callable, Type

import bambi as bmb
import numpy as np
Expand Down Expand Up @@ -384,7 +384,7 @@ def dist(cls, **kwargs): # pylint: disable=arguments-renamed

def logp(data, *dist_params): # pylint: disable=E0213
num_params = len(list_params)
extra_fields: Iterable[np.ndarray] = []
extra_fields = []

if num_params < len(dist_params):
extra_fields = dist_params[num_params:]
Expand Down
3 changes: 2 additions & 1 deletion src/hssm/plotting/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Plotting functionalities for HSSM."""

from .posterior_predictive import plot_posterior_predictive
from .quantile_probability import plot_quantile_probability

__all__ = ["plot_posterior_predictive"]
__all__ = ["plot_posterior_predictive", "plot_quantile_probability"]
18 changes: 9 additions & 9 deletions src/hssm/plotting/quantile_probability.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import logging
from itertools import product
from typing import Any, Iterable, Mapping
from typing import Any, Iterable

import arviz as az
import matplotlib as mpl
Expand Down Expand Up @@ -36,8 +36,8 @@ def _plot_quantile_probability_1D(
xlabel: str | None = "Proportion",
ylabel: str | None = None,
xticklabels: Iterable["str"] | None = None,
data_kwargs: Mapping[str, Any] | None = None,
pps_kwargs: Mapping[str, Any] | None = None,
data_kwargs: dict[str, Any] | None = None,
pps_kwargs: dict[str, Any] | None = None,
**kwargs,
) -> mpl.axes.Axes:
"""Produce one quantile probability plot.
Expand Down Expand Up @@ -129,9 +129,9 @@ def _plot_quantile_probability_2D(
xlabel: str | None = "Proportion",
ylabel: str | None = None,
xticklabels: Iterable["str"] | None = None,
grid_kwargs: Mapping[str, Any] | None = None,
data_kwargs: Mapping[str, Any] | None = None,
pps_kwargs: Mapping[str, Any] | None = None,
grid_kwargs: dict[str, Any] | None = None,
data_kwargs: dict[str, Any] | None = None,
pps_kwargs: dict[str, Any] | None = None,
**kwargs,
) -> sns.FacetGrid:
"""Plot the quantile probabilities against the observed data.
Expand Down Expand Up @@ -207,9 +207,9 @@ def plot_quantile_probability(
xlabel: str | None = "Proportion",
ylabel: str | None = None,
xticklabels: Iterable["str"] | None = None,
grid_kwargs: Mapping[str, Any] | None = None,
data_kwargs: Mapping[str, Any] | None = None,
pps_kwargs: Mapping[str, Any] | None = None,
grid_kwargs: dict[str, Any] | None = None,
data_kwargs: dict[str, Any] | None = None,
pps_kwargs: dict[str, Any] | None = None,
**kwargs,
) -> sns.FacetGrid:
"""Plot the quantile probabilities against the observed data.
Expand Down
4 changes: 2 additions & 2 deletions src/hssm/plotting/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Plotting utilities for HSSM."""

import logging
from typing import Any, Iterable, Mapping, cast
from typing import Any, Iterable, cast

import arviz as az
import numpy as np
Expand Down Expand Up @@ -311,7 +311,7 @@ def _check_groups_and_groups_order(
)
if groups_order is not None:
if isinstance(groups_order, Iterable) and not isinstance(
groups_order, Mapping
groups_order, dict
):
if not isinstance(groups, str):
raise ValueError(
Expand Down
Binary file modified tests/fixtures/cavanagh_idata.nc
Binary file not shown.
Binary file modified tests/fixtures/cavanagh_idata_pps.nc
Binary file not shown.

0 comments on commit 8772a69

Please sign in to comment.