internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: arviz-devs/arviz

Issue:
Add an examples of coords argument in documentation
**Describe the bug**
There's this fancy coords argument but not a great explanation on how to use it in the code examples below
https://arviz-devs.github.io/arviz/api/generated/arviz.plot_posterior.html

![image](https://user-images.githubusercontent.com/7213793/97931298-2adaad80-1d22-11eb-9e97-3e46ed2f9650.png)


**To Reproduce**
Look at the doc, notice the lack of coords documentation in the code example

**Expected behavior**
Theres an example in the code below



Discussion:
@canyon289 I would like to take on this issue, do you mind assigning it to me ?
Assigned it to you! Thanks for your interest, let us know if you have any questions about the contributing process :smile: 
Hello! I am very much interested and would like to start off. Is it open and if so ,can you assign it to me ?

@vardaan-raj It is open and I will assign it to you right now!



Resolving patch:
diff --git a/arviz/plots/posteriorplot.py b/arviz/plots/posteriorplot.py
--- a/arviz/plots/posteriorplot.py
+++ b/arviz/plots/posteriorplot.py
@@ -149,6 +149,13 @@ def plot_posterior(
         >>> rope = {'mu': [{'rope': (-2, 2)}], 'theta': [{'school': 'Choate', 'rope': (2, 4)}]}
         >>> az.plot_posterior(data, var_names=['mu', 'theta'], rope=rope)
 
+    Using `coords` argument to plot only a subset of data
+
+    .. plot::
+        :context: close-figs
+
+        >>> coords = {"school": ["Choate","Phillips Exeter"]}
+        >>> az.plot_posterior(data, var_names=["mu", "theta"], coords=coords)
 
     Add reference lines
 


Test patch:
Repository: arviz-devs/arviz

Issue:
Debug print left in release version
**Describe the bug**

While invoking `from_pymc3` I got unexpected output:

```
0, dim: AND rows, 1376 =? 1376
0, dim: NAND rows, 1799 =? 1799
0, dim: NOR rows, 1699 =? 1699
0, dim: OR rows, 1370 =? 1370
0, dim: XNOR rows, 1510 =? 1510
0, dim: XOR rows, 1674 =? 1674
```

The strings after `dim:` are names of dimensions in the `InferenceData` object being created. 

I find this in `arviz/data/base.py`:

    print(f"{i}, dim: {dim}, {dim_size} =? {len(coords.get(dim, []))}") 

See https://github.com/arviz-devs/arviz/blob/718eb31ed844c3bb71d564736af54e203ca0dc3a/arviz/data/base.py#L116

This line should either be deleted or replaced by an equivalent logging function call.

This line in the code is gated by the parameter `skip_event_dims` which is not explained in the docstring.  See https://github.com/arviz-devs/arviz/blob/718eb31ed844c3bb71d564736af54e203ca0dc3a/arviz/data/base.py#L73

I'm actually not even sure what an event dimension is, as opposed to any other kind of dimension, so some more information about this parameter would be very helpful.


Discussion:
Extra info on `event_dim` in addition to the explanations in the PR (https://github.com/arviz-devs/arviz/pull/1429) that introduced the changes:

I took the naming from tensorflow probability, they define:

> * Event shape describes the shape of a single draw from the distribution; it may be dependent across dimensions. For scalar distributions, the event shape is []. For a 5-dimensional MultivariateNormal, the event shape is [5].
> * Batch shape describes independent, not identically distributed draws, aka a "batch" of distributions.
> * Sample shape describes independent, identically distributed draws of batches from the distribution family.

So for example, if we model our 50 observations as 3d multivariate normals, and took 4 chains, 200 draws from the posterior, then the shape of the posterior predictive would be (4, 200, 50, 3) with (4, 200) being the sample shape, 50 the batch shape and 3 the event shape. log likelihood however will not have the same shape, as the event shape is reduced. Before that PR, things worked as long as no dims were passed to the converter (the defaults are generated on a per group basis) but would fail if dims were passed given that the variables in posterior predictive and in log likelihood have the same name
> This line should either be deleted or replaced by an equivalent logging function call.

This line should be deleted, it is a remnant of some debugging I did when adding the feature.

Resolving patch:
diff --git a/arviz/data/base.py b/arviz/data/base.py
--- a/arviz/data/base.py
+++ b/arviz/data/base.py
@@ -113,7 +113,6 @@ def generate_dims_coords(
     if skip_event_dims:
         # this is needed in case the reduction keeps the dimension with size 1
         for i, (dim, dim_size) in enumerate(zip(dims, shape)):
-            print(f"{i}, dim: {dim}, {dim_size} =? {len(coords.get(dim, []))}")
             if (dim in coords) and (dim_size != len(coords[dim])):
                 dims = dims[:i]
                 break


Test patch:
Repository: arviz-devs/arviz

Issue:
Remove compare warning
I think we can already remove the following warning from `az.compare`:

```
/home/oriol/miniconda3/envs/arviz/lib/python3.8/site-packages/arviz/stats/stats.py:146: UserWarning: The default method used to estimate the weights for each model,has changed from BB-pseudo-BMA to stacking 
```



Discussion:
Hi @OriolAbril, I went through the function, is it because users get used to the new default method so that no need to specifically mention it? and just for clarifying, we just need to remove the warning right? do we need to update anything else?
exactly, it has been around for a while and is no longer needed. It should be removed and nothing else.

Resolving patch:
diff --git a/arviz/stats/stats.py b/arviz/stats/stats.py
--- a/arviz/stats/stats.py
+++ b/arviz/stats/stats.py
@@ -143,10 +143,6 @@ def compare(
     waic : Compute the widely applicable information criterion.
 
     """
-    warnings.warn(
-        "The default method used to estimate the weights for each model,"
-        "has changed from BB-pseudo-BMA to stacking"
-    )
     names = list(dataset_dict.keys())
     scale = rcParams["stats.ic_scale"] if scale is None else scale.lower()
     if scale == "log":


Test patch:
Repository: arviz-devs/arviz

Issue:
invert the order of links in sampling wrapper docstrings
https://arviz-devs.github.io/arviz/api/generated/arviz.SamplingWrapper.html#arviz.SamplingWrapper has a link to the api section corresponding to all the wrappers and a link to the user guide section about the wrappers. The temptation to click on the first link and be done with it is strong, so I think I'd be better to invert the order and get the readers to the user guide by "default" instead of the api docs.

Note: the source of the page of the docs linked above is at https://github.com/arviz-devs/arviz/blob/main/arviz/wrappers/base.py#L15


Discussion:
I would like to contribute here but since I am new to this, could you guide me?


Yes, have you read the [contributing guide](https://github.com/arviz-devs/arviz/blob/main/CONTRIBUTING.md)? There is an step by step guide to set up your fork and getting started editing the source code. Let me know if any of the steps are not clear enough.

Resolving patch:
diff --git a/arviz/wrappers/base.py b/arviz/wrappers/base.py
--- a/arviz/wrappers/base.py
+++ b/arviz/wrappers/base.py
@@ -12,8 +12,8 @@ class SamplingWrapper:
     functions requiring refitting like Leave Future Out or Simulation Based Calibration can be
     performed from ArviZ.
 
-    See other SamplingWrapper classes at :ref:`wrappers api section <wrappers_api>`. For
-    usage examples see user guide pages on :ref:`wrapper_guide`.
+    For usage examples see user guide pages on :ref:`wrapper_guide`.See other
+    SamplingWrapper classes at :ref:`wrappers api section <wrappers_api>`.
 
     Parameters
     ----------


Test patch:
Repository: arviz-devs/arviz

Issue:
[DOC] Add docs to showcase existing `Dask` support.
## Tell us about it

As @OriolAbril has pointed out in the gitter room, Arviz lacks on the documentation side for showing the current `Dask` capabilities in the stats module which was recently added in #1229 . 

[Computation](https://arviz-devs.github.io/arviz/user_guide/computation.html) page mentions about this as well.

## Thoughts on implementation

Just like [Numba - an overview](https://arviz-devs.github.io/arviz/user_guide/Numba.html), we can create a notebook where we can show the usage and effectiveness of `Dask` in an example workflow.



Discussion:
Since, I plan to work on the [`Speed-up, parallelize and distribute ArviZ`](https://github.com/arviz-devs/arviz/wiki/GSoC-2021-projects#speed-up-parallelize-and-distribute-arviz-python) project this summer... I would like to work on this issue.

Any suggestions/feedbacks are appreciated.

Resolving patch:
diff --git a/arviz/stats/stats_utils.py b/arviz/stats/stats_utils.py
--- a/arviz/stats/stats_utils.py
+++ b/arviz/stats/stats_utils.py
@@ -192,7 +192,7 @@ def wrap_xarray_ufunc(
     Parameters
     ----------
     ufunc : callable
-    datasets : xarray.dataset
+    *datasets : xarray.Dataset
     ufunc_kwargs : dict
         Keyword arguments passed to `make_ufunc`.
             - 'n_dims', int, by default 2
@@ -207,13 +207,13 @@ def wrap_xarray_ufunc(
             - 'out_shape', int, by default None
     dask_kwargs : dict
         Dask related kwargs passed to :func:`xarray:xarray.apply_ufunc`.
-        Use :meth:`~arviz.Dask.enable_dask` to set default kwargs.
+        Use ``enable_dask`` method of :class:`arviz.Dask` to set default kwargs.
     **kwargs
-        Passed to xarray.apply_ufunc.
+        Passed to :func:`xarray.apply_ufunc`.
 
     Returns
     -------
-    xarray.dataset
+    xarray.Dataset
     """
     if ufunc_kwargs is None:
         ufunc_kwargs = {}
diff --git a/doc/source/conf.py b/doc/source/conf.py
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -318,5 +318,6 @@ def ipython_directive_transform(source):
     "bokeh": ("https://docs.bokeh.org/en/latest/", None),
     "scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
     "zarr": ("https://zarr.readthedocs.io/en/stable/", None),
-    "numpy": ("https://numpy.org/doc/stable/", None)
+    "numpy": ("https://numpy.org/doc/stable/", None),
+    "dask": ("https://docs.dask.org/en/latest/", None),
 }


Test patch:
Repository: arviz-devs/arviz

Issue:
from_pyro fails when MCMC is run on GPU
When MCMC is performed on a GPU, from_pyro fails, as the sites returned by
`trace = pyro.poutine.trace(self.model).get_trace(*self._args, **self._kwargs)` can be tensors that still live on the GPU. 
This will cause this line to break: 
https://github.com/arviz-devs/arviz/blob/1f3b8fd0eaafcf58aad09a80d309b2a4b40dd191/arviz/data/io_pyro.py#L231

Since there is currently no easy way of transferring a pyro MCMC object to the cpu, a workaround is adding a `.cpu()`to this line:
https://github.com/arviz-devs/arviz/blob/1f3b8fd0eaafcf58aad09a80d309b2a4b40dd191/arviz/data/io_pyro.py#L111


Discussion:
That sounds ok solution.

Is there a way to see if the trace is on cpu or gpu? And should we unpack data from gpu in one step or one-by-one (when numpy array is creates)

Resolving patch:
diff --git a/arviz/data/io_pyro.py b/arviz/data/io_pyro.py
--- a/arviz/data/io_pyro.py
+++ b/arviz/data/io_pyro.py
@@ -110,7 +110,7 @@ def arbitrary_element(dct):
         if self.model is not None:
             trace = pyro.poutine.trace(self.model).get_trace(*self._args, **self._kwargs)
             observations = {
-                name: site["value"]
+                name: site["value"].cpu()
                 for name, site in trace.nodes.items()
                 if site["type"] == "sample" and site["is_observed"]
             }


Test patch:
Repository: arviz-devs/arviz

Issue:
Adding plot_forest example for multiple datasets
I was thinking that we could add an example of how to use `plot_forest` for multiple datasets. It would help newcomers and also the example would help us demonstrate the feature of legends as it is only valid for multiple datasets


Discussion:

Resolving patch:
diff --git a/arviz/plots/forestplot.py b/arviz/plots/forestplot.py
--- a/arviz/plots/forestplot.py
+++ b/arviz/plots/forestplot.py
@@ -145,6 +145,21 @@ def plot_forest(
         >>>                            figsize=(9, 7))
         >>> axes[0].set_title('Estimated theta for 8 schools model')
 
+    Forestplot with multiple datasets
+
+    .. plot::
+        :context: close-figs
+
+        >>> centered_data = az.load_arviz_data('centered_eight')
+        >>> axes = az.plot_forest([non_centered_data, centered_data],
+        >>>                            model_names = ["non centered eight", "centered eight"],
+        >>>                            kind='forestplot',
+        >>>                            var_names=["^the"],
+        >>>                            filter_vars="regex",
+        >>>                            combined=True,
+        >>>                            figsize=(9, 7))
+        >>> axes[0].set_title('Estimated theta for 8 schools models')
+
     Forestpĺot with ropes
 
     .. plot::


Test patch:
Repository: arviz-devs/arviz

Issue:
Validate argument to `filter_vars`
Right now, passing anything other than the allowed values (None, 'like', 'regex') doesn't raise

Unless there are objections, I'll make a PR to raise if anything else is passed


Discussion:

Resolving patch:
diff --git a/arviz/data/inference_data.py b/arviz/data/inference_data.py
--- a/arviz/data/inference_data.py
+++ b/arviz/data/inference_data.py
@@ -1450,6 +1450,11 @@ def _group_names(
         -------
         groups: list
         """
+        if filter_groups not in {None, "like", "regex"}:
+            raise ValueError(
+                f"'filter_groups' can only be None, 'like', or 'regex', got: '{filter_groups}'"
+            )
+
         all_groups = self._groups_all
         if groups is None:
             return all_groups
diff --git a/arviz/utils.py b/arviz/utils.py
--- a/arviz/utils.py
+++ b/arviz/utils.py
@@ -34,6 +34,11 @@ def _var_names(var_names, data, filter_vars=None):
     -------
     var_name: list or None
     """
+    if filter_vars not in {None, "like", "regex"}:
+        raise ValueError(
+            f"'filter_vars' can only be None, 'like', or 'regex', got: '{filter_vars}'"
+        )
+
     if var_names is not None:
         if isinstance(data, (list, tuple)):
             all_vars = []


Test patch:
diff --git a/arviz/tests/base_tests/test_data.py b/arviz/tests/base_tests/test_data.py
--- a/arviz/tests/base_tests/test_data.py
+++ b/arviz/tests/base_tests/test_data.py
@@ -509,6 +509,15 @@ def test_group_names(self, args_res):
         group_names = idata._group_names(*args)  # pylint: disable=protected-access
         assert np.all([name in result for name in group_names])
 
+    def test_group_names_invalid_args(self):
+        ds = dict_to_dataset({"a": np.random.normal(size=(3, 10))})
+        idata = InferenceData(posterior=(ds, ds))
+        msg = r"^\'filter_groups\' can only be None, \'like\', or \'regex\', got: 'foo'$"
+        with pytest.raises(ValueError, match=msg):
+            idata._group_names(  # pylint: disable=protected-access
+                ("posterior",), filter_groups="foo"
+            )
+
     @pytest.mark.parametrize("inplace", [False, True])
     def test_isel(self, data_random, inplace):
         idata = data_random
diff --git a/arviz/tests/base_tests/test_utils.py b/arviz/tests/base_tests/test_utils.py
--- a/arviz/tests/base_tests/test_utils.py
+++ b/arviz/tests/base_tests/test_utils.py
@@ -101,6 +101,15 @@ def test_var_names_filter(var_args):
     assert _var_names(var_names, data, filter_vars) == expected
 
 
+def test_var_names_filter_invalid_argument():
+    """Check invalid argument raises."""
+    samples = np.random.randn(10)
+    data = dict_to_dataset({"alpha": samples})
+    msg = r"^\'filter_vars\' can only be None, \'like\', or \'regex\', got: 'foo'$"
+    with pytest.raises(ValueError, match=msg):
+        assert _var_names(["alpha"], data, filter_vars="foo")
+
+
 def test_subset_list_negation_not_found():
     """Check there is a warning if negation pattern is ignored"""
     names = ["mu", "theta"]
Repository: arviz-devs/arviz

Issue:
Change order of regularization in psislw
The [PSIS paper](https://arxiv.org/abs/1507.02646) is ambiguous as to whether the regularization of the shape parameter of the generalized Pareto distribution (in appendix C) should be performed before or after the scale parameter is estimated. ArviZ currently does it before, while loo does it afterwards. On Slack, @avehtari said:

> loo package implementation is intentional, and based on my experiments produces better results than the alternative. The joint distribution has strong dependency, which is further exaggerated by the use of profile likelihood and point estimates. It seems it's better to let the prior affect only k.

So I believe all we need to do is swap these two lines:

https://github.com/arviz-devs/arviz/blob/045ddd3b7c3f7ff3ab082cfc0f207e09dce9e629/arviz/stats/stats.py#L955-L956



Discussion:
I am new to open source environment, can you assign me to this isssue for my first issue? 
Thanks. :)
Sure! Thanks!

Resolving patch:
diff --git a/arviz/stats/stats.py b/arviz/stats/stats.py
--- a/arviz/stats/stats.py
+++ b/arviz/stats/stats.py
@@ -952,8 +952,8 @@ def _gpdfit(ary):
     # estimate for k
     k_post = np.log1p(-b_post * ary).mean()  # pylint: disable=invalid-unary-operand-type,no-member
     # add prior for k_post
-    k_post = (n * k_post + prior_k * 0.5) / (n + prior_k)
     sigma = -k_post / b_post
+    k_post = (n * k_post + prior_k * 0.5) / (n + prior_k)
 
     return k_post, sigma
 


Test patch:
Repository: arviz-devs/arviz

Issue:
Deprecated Frame.append and Series.append in Pandas
**Describe the bug**
FutureWarning about `.append()` deprecation. From pandas [documentation](https://pandas.pydata.org/docs/whatsnew/v1.4.0.html):
> DataFrame.append() and Series.append() have been deprecated and will be removed in Pandas 2.0. Use pandas.concat() instead (GH35407).

**To Reproduce**
```python
az.compare({
    'm1': trace_1,
    'm2': trace_2,
})
```

```python
~/miniconda3/lib/python3.9/site-packages/arviz/stats/stats.py:212: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  ics = ics.append([ic_func(dataset, pointwise=True, scale=scale)])
~/miniconda3/lib/python3.9/site-packages/arviz/stats/stats.py:212: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  ics = ics.append([ic_func(dataset, pointwise=True, scale=scale)])
```

**Additional context**
```
ArviZ version: 0.11.2
Pandas version: 1.4.0
```


Discussion:

Resolving patch:
diff --git a/arviz/stats/stats.py b/arviz/stats/stats.py
--- a/arviz/stats/stats.py
+++ b/arviz/stats/stats.py
@@ -239,17 +239,16 @@ def compare(
     p_ic = f"p_{ic}"
     ic_i = f"{ic}_i"
 
-    ics = pd.DataFrame()
-    names = []
+    ics_dict = {}
     for name, dataset in dataset_dict.items():
-        names.append(name)
         try:
             # Here is where the IC function is actually computed -- the rest of this
             # function is argument processing and return value formatting
-            ics = ics.append([ic_func(dataset, pointwise=True, scale=scale, var_name=var_name)])
+            ics_dict[name] = ic_func(dataset, pointwise=True, scale=scale, var_name=var_name)
         except Exception as e:
             raise e.__class__(f"Encountered error trying to compute {ic} from model {name}.") from e
-    ics.index = names
+
+    ics = pd.DataFrame.from_dict(ics_dict, orient="index")
     ics.sort_values(by=ic, inplace=True, ascending=ascending)
     ics[ic_i] = ics[ic_i].apply(lambda x: x.values.flatten())
 


Test patch:
Repository: arviz-devs/arviz

Issue:
plot_dot 
**Describe the bug**
plotdot fig size doesn't behave the way I expect, in that when I set `figsize` in an axes that triple a previous one its not triple the size. There also are some minor bugs where the dots seem to be overlapping some

**To Reproduce**
```
samples = stats.beta(2,2).rvs(100)

width = 10
fig, ax = plt.subplots(figsize=(width, 10))
az.plot_dot(samples, ax=ax)
ax.set_title(f"Width: {width}")
ax.set_xlim(0,1)
```

Then try this, but see that figure is not three times the width
```
width = 30
fig, ax = plt.subplots(figsize=(width, 10))
az.plot_dot(samples, ax=ax)
ax.set_title(f"Width: {width}")
ax.set_xlim(0,1)
```

![image](https://user-images.githubusercontent.com/7213793/168452674-b1a38bf9-db25-459e-85b0-cd61348283cd.png)
![image](https://user-images.githubusercontent.com/7213793/168452677-1410fd7b-7208-4045-ac8d-cbc52c0595dd.png)


**Expected behavior**
Figsize from `plt.subplots` is respected

**Additional context**
Arviz '0.12.0'



Discussion:

Resolving patch:
diff --git a/arviz/plots/backends/matplotlib/dotplot.py b/arviz/plots/backends/matplotlib/dotplot.py
--- a/arviz/plots/backends/matplotlib/dotplot.py
+++ b/arviz/plots/backends/matplotlib/dotplot.py
@@ -106,7 +106,7 @@ def plot_dot(
     else:
         ax.tick_params(left=False, labelleft=False)
 
-    ax.set_aspect("equal", adjustable="box")
+    ax.set_aspect("equal", adjustable="datalim")
     ax.autoscale()
 
     if backend_show(show):


Test patch:
Repository: arviz-devs/arviz

Issue:
Remove deprecated arguments from `plot_pair()`
`plot_kwargs` is an argument of `plot_pair()` yet it is not described in the [documentation](https://python.arviz.org/en/latest/api/generated/arviz.plot_pair.html#arviz.plot_pair) for this function.

**To Reproduce**
Go to the link and search for the description of `plot_kwargs`

**Expected behavior**
A complete docstring were `plot_kwargs` usage and behaviour is described.




Discussion:
It might also be possible it is not even used at all, in which case it should be removed instead of documented
You are right, we planned to deprecate `plot_kwargs` (see [here](https://github.com/arviz-devs/arviz/blob/161eb5f9d2acc8680bca62cb5e8f5a6565d0c9d6/arviz/plots/pairplot.py#L196)) Maybe we can move forward with it instead of documenting
Let's remove it then and update the issue to remove the deprecated arguments in plot_pair. I am also adding it to the v0.13 milestone.

Resolving patch:
diff --git a/arviz/plots/pairplot.py b/arviz/plots/pairplot.py
--- a/arviz/plots/pairplot.py
+++ b/arviz/plots/pairplot.py
@@ -24,9 +24,6 @@ def plot_pair(
     textsize=None,
     kind: Union[str, List[str]] = "scatter",
     gridsize="auto",
-    contour: Optional[bool] = None,
-    plot_kwargs=None,
-    fill_last=False,
     divergences=False,
     colorbar=False,
     labeller=None,
@@ -82,11 +79,6 @@ def plot_pair(
         such that the hexagons are approximately regular. Alternatively, gridsize
         can be a tuple with two elements specifying the number of hexagons
         in the x-direction and the y-direction.
-    contour : bool, optional, deprecated, Defaults to True.
-        If True plot the 2D KDE using contours, otherwise plot a smooth 2D KDE. Defaults to True.
-        **Note:** this default is implemented in the body of the code, not in argument processing.
-    fill_last : bool
-        If True fill the last contour of the 2D KDE plot. Defaults to True.
     divergences: Boolean
         If True divergences will be plotted in a different color, only if group is either 'prior'
         or 'posterior'.
@@ -188,17 +180,6 @@ def plot_pair(
         kind_boolean = [kind[i] in valid_kinds for i in range(len(kind))]
     if not np.all(kind_boolean):
         raise ValueError(f"Plot type {kind} not recognized. Plot type must be in {valid_kinds}")
-    if fill_last or contour:
-        warnings.warn(
-            "fill_last and contour will be deprecated. Please use kde_kwargs",
-            UserWarning,
-        )
-    if plot_kwargs:
-        warnings.warn(
-            "plot_kwargs will be deprecated."
-            " Please use scatter_kwargs, kde_kwargs and/or hexbin_kwargs",
-            UserWarning,
-        )
 
     if coords is None:
         coords = {}


Test patch: