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

Issue:
Add more fitted models
figshare (https://figshare.com/) seems like a possibility that I think scikit-learn uses. In terms of size, [the radon example here](https://docs.pymc.io/notebooks/multilevel_modeling.html) generates a netCDF file of about 15MB, which is not so bad.

Perhaps it could even be hosted in a separate github repo?


Discussion:
Could we do simple linear regression with 100 datapoints? Could help to move forward regression plots.

Also multivariate example would be nice.

Resolving patch:
diff --git a/arviz/data/datasets.py b/arviz/data/datasets.py
--- a/arviz/data/datasets.py
+++ b/arviz/data/datasets.py
@@ -77,6 +77,53 @@
 
 See https://docs.pymc.io/notebooks/rugby_analytics.html by Peader Coyle
 for more details and references.
+""",
+    ),
+    "regression1d": RemoteFileMetadata(
+        filename="regression1d.nc",
+        url="https://ndownloader.figshare.com/files/16254899",
+        checksum="909e8ffe344e196dad2730b1542881ab5729cb0977dd20ba645a532ffa427278",
+        description="""
+A synthetic one dimensional linear regression dataset with latent slope,
+intercept, and noise ("eps"). One hundred data points, fit with PyMC3.
+
+True slope and intercept are included as deterministic variables.
+""",
+    ),
+    "regression10d": RemoteFileMetadata(
+        filename="regression10d.nc",
+        url="https://ndownloader.figshare.com/files/16255736",
+        checksum="c6716ec7e19926ad2a52d6ae4c1d1dd5ddb747e204c0d811757c8e93fcf9f970",
+        description="""
+A synthetic multi-dimensional (10 dimensions) linear regression dataset with
+latent weights ("w"), intercept, and noise ("eps"). Five hundred data points,
+fit with PyMC3.
+
+True weights and intercept are included as deterministic variables.
+""",
+    ),
+    "classification1d": RemoteFileMetadata(
+        filename="classification1d.nc",
+        url="https://ndownloader.figshare.com/files/16256678",
+        checksum="1cf3806e72c14001f6864bb69d89747dcc09dd55bcbca50aba04e9939daee5a0",
+        description="""
+A synthetic one dimensional logistic regression dataset with latent slope and
+intercept, passed into a Bernoulli random variable. One hundred data points,
+fit with PyMC3.
+
+True slope and intercept are included as deterministic variables.
+""",
+    ),
+    "classification10d": RemoteFileMetadata(
+        filename="classification10d.nc",
+        url="https://ndownloader.figshare.com/files/16256681",
+        checksum="16c9a45e1e6e0519d573cafc4d266d761ba347e62b6f6a79030aaa8e2fde1367",
+        description="""
+A synthetic multi dimensional (10 dimensions) logistic regression dataset with
+latent weights ("w") and intercept, passed into a Bernoulli random variable.
+Five hundred data points, fit with PyMC3.
+
+True weights and intercept are included as deterministic variables.
 """,
     ),
 }


Test patch:
Repository: arviz-devs/arviz

Issue:
az.compare fails for pymc3 mixture models
**Describe the bug**
<img width="840" alt="image" src="https://user-images.githubusercontent.com/7213793/61141152-c5eeaa80-a481-11e9-87f3-03eedfc23b78.png">

I believe it's because of the extra coord in ic
<img width="587" alt="image" src="https://user-images.githubusercontent.com/7213793/61141476-8aa0ab80-a482-11e9-8ad5-6441f7d514e9.png">
**To Reproduce**
```
import arviz as az
import pymc3 as pm
import numpy as np

vals=np.array([1,2,3])
with pm.Model() as m:
    mu = pm.Normal("mu", mu=0, sd=1)
    y = pm.Normal("y", mu=mu, sd=1, observed=vals)
    trace=pm.sample(draws=100, tune=100)

data = az.from_pymc3(trace=trace)
comp = az.compare({"trace": data, "trace_2":data})
print(comp)

# Mixture model
with pm.Model() as two_components:
    p = pm.Dirichlet("p", a=np.ones(2))

    # Each mean of the mixture data has its own estimate of a mean with a fixed SD in this case
    means = pm.Normal("means", mu=vals.mean(), sd=10, shape=2)

    # Estimate of the standard deviation of what?
    sd = pm.HalfCauchy("sd", 1)
    y = pm.NormalMixture("y", w=p, mu=means, sd=sd, observed=vals)
    trace_mixture = pm.sample(draws=10, tune=10)

data_mixture = az.from_pymc3(trace=trace_mixture)

# Failing line
comp = az.compare({"trace": data_mixture, "trace_2":data_mixture})

```

**Expected behavior**
Comparison dataframe generated

**Additional context**
Appear on 0.4.1



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
@@ -196,6 +196,7 @@ def compare(
         ics = ics.append([ic_func(dataset, pointwise=True, scale=scale)])
     ics.index = names
     ics.sort_values(by=ic, inplace=True, ascending=ascending)
+    ics[ic_i] = ics[ic_i].apply(lambda x: x.values.flatten())
 
     if method.lower() == "stacking":
         rows, cols, ic_i_val = _ic_matrix(ics, ic_i)
@@ -263,9 +264,9 @@ def gradient(weights):
         for idx, val in enumerate(ics.index):
             res = ics.loc[val]
             if scale_value < 0:
-                diff = (res[ic_i] - min_ic_i_val).values
+                diff = res[ic_i] - min_ic_i_val
             else:
-                diff = (min_ic_i_val - res[ic_i]).values
+                diff = min_ic_i_val - res[ic_i]
             d_ic = np.sum(diff)
             d_std_err = np.sqrt(len(diff) * np.var(diff))
             std_err = ses.loc[val]


Test patch:
Repository: arviz-devs/arviz

Issue:
outdated docstring for io_cmdstanpy.from_cmdstanpy
**Describe the bug**

The docstring comments need to be updated to current (and relatively stable) version
of CmdStanPy -  comments on lines 294 - 303 refer to PyCmdStan

The code itself is correct and tested by PRs https://github.com/arviz-devs/arviz/pull/758 and https://github.com/arviz-devs/arviz/pull/759



Discussion:
Hi, thanks for noticing. Let's fix these.

Resolving patch:
diff --git a/arviz/data/io_cmdstanpy.py b/arviz/data/io_cmdstanpy.py
--- a/arviz/data/io_cmdstanpy.py
+++ b/arviz/data/io_cmdstanpy.py
@@ -1,4 +1,4 @@
-"""CmdStan-specific conversion code."""
+"""CmdStanPy-specific conversion code."""
 from collections import defaultdict
 from copy import deepcopy
 import logging
@@ -37,6 +37,9 @@ def __init__(
         self.prior = prior
         self.prior_predictive = prior_predictive
         self.observed_data = observed_data
+        if isinstance(log_likelihood, (list, tuple)):
+            if len(log_likelihood) == 1:
+                log_likelihood = log_likelihood[0]
         self.log_likelihood = log_likelihood
         self.coords = coords
         self.dims = dims
@@ -291,16 +294,16 @@ def from_cmdstanpy(
     coords=None,
     dims=None
 ):
-    """Convert CmdStan data into an InferenceData object.
+    """Convert CmdStanPy data into an InferenceData object.
 
     Parameters
     ----------
-    posterior : PosteriorSample object
-        PyCmdStan PosteriorSample
+    posterior : StanFit object
+        CmdStanPy StanFit
     posterior_predictive : str, list of str
         Posterior predictive samples for the fit.
-    prior : PosteriorSample
-        PyCmdStan PosteriorSample
+    prior : StanFit
+        CmdStanPy StanFit
     prior_predictive : str, list of str
         Prior predictive samples for the fit.
     observed_data : dict


Test patch:
Repository: arviz-devs/arviz

Issue:
summary throws error on missing variables while plots do not
There is an inconsistency across functions as to how ArviZ handles `var_names` that don't exist in the model. Plots simply ignore them; the following model actually has no `s_γ' variable, but `plot_trace` simply ignores it and plots the rest:

    az.plot_trace(trace, var_names=['m_μ', 'm_β', 's_μ', 's_β', 's_γ', 'σ', 'ν']);

whereas, the same arguments passed to `summary` throws a `KeyError`:

    az.summary(trace, var_names=['m_μ', 'm_β', 's_μ', 's_β', 's_γ', 'σ', 'ν']);

```
~/anaconda3/envs/org_velo/lib/python3.7/site-packages/xarray/core/dataset.py in _get_virtual_variable(variables, key, level_vars, dim_sizes)
     89         ref_var = dim_var.to_index_variable().get_level_variable(ref_name)
     90     else:
---> 91         ref_var = variables[ref_name]
     92 
     93     if var_name is None:

KeyError: 's_γ'
```
I prefer the error, but they should .at least behave similarly across functions.


Discussion:

Resolving patch:
diff --git a/arviz/plots/ppcplot.py b/arviz/plots/ppcplot.py
--- a/arviz/plots/ppcplot.py
+++ b/arviz/plots/ppcplot.py
@@ -191,9 +191,10 @@ def plot_ppc(
     posterior_predictive = data.posterior_predictive
 
     if var_names is None:
-        var_names = observed.data_vars
+        var_names = list(observed.data_vars)
     var_names = _var_names(var_names, observed)
     pp_var_names = [data_pairs.get(var, var) for var in var_names]
+    pp_var_names = _var_names(pp_var_names, posterior_predictive)
 
     if flatten_pp is None and flatten is None:
         flatten_pp = list(posterior_predictive.dims.keys())
diff --git a/arviz/utils.py b/arviz/utils.py
--- a/arviz/utils.py
+++ b/arviz/utils.py
@@ -49,6 +49,14 @@ def _var_names(var_names, data):
         if excluded_vars:
             var_names = [i for i in all_vars if i not in excluded_vars]
 
+        existent_vars = np.isin(var_names, all_vars)
+        if not np.all(existent_vars):
+            raise KeyError(
+                "{} var names are not present in dataset".format(
+                    np.array(var_names)[~existent_vars]
+                )
+            )
+
     return var_names
 
 


Test patch:
diff --git a/arviz/tests/test_utils.py b/arviz/tests/test_utils.py
--- a/arviz/tests/test_utils.py
+++ b/arviz/tests/test_utils.py
@@ -48,6 +48,11 @@ def test_var_names_warning():
         assert _var_names(var_names, data) == expected
 
 
+def test_var_names_key_error(data):
+    with pytest.raises(KeyError, match="bad_var_name"):
+        _var_names(("theta", "tau", "bad_var_name"), data)
+
+
 @pytest.fixture(scope="function")
 def utils_with_numba_import_fail(monkeypatch):
     """Patch numba in utils so when its imported it raises ImportError"""
Repository: arviz-devs/arviz

Issue:
pm.compare seems not compatible with az.plot_compare
If I try to run two following commands
```python
df_comp_WAIC = pm.compare({models[0]: traces[0], models[1]: traces[1]})
az.plot_compare(df_comp_WAIC);
```
I get the error:
```python
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-208-a89027c76a69> in <module>
      3 df_comp_WAIC = pm.compare({models[0]: traces[0], models[1]: traces[1]})
----> 4 az.plot_compare(df_comp_WAIC);

~/anaconda3/lib/python3.6/site-packages/arviz/plots/compareplot.py in plot_compare(comp_df, insample_dev, plot_standard_error, plot_ic_diff, figsize, textsize, plot_kwargs, ax)
     99         raise ValueError(
    100             "comp_df must contain one of the following"
--> 101             " information criterion: {}".format(_information_criterion)
    102         )
    103 

ValueError: comp_df must contain one of the following information criterion: ['waic', 'loo']
```

Both pymc3 and arviz are the latest from github (using pip command)


Discussion:
Just to double check can you check what columns exist in `df_comp_WAIC` to see if somehow waic or loo are being omitted?
I can confirm this error I will fix it

Resolving patch:
diff --git a/arviz/plots/compareplot.py b/arviz/plots/compareplot.py
--- a/arviz/plots/compareplot.py
+++ b/arviz/plots/compareplot.py
@@ -95,8 +95,9 @@ def plot_compare(
     yticks_labels = [""] * len(yticks_pos)
 
     _information_criterion = ["waic", "loo"]
+    column_index = [c.lower() for c in comp_df.columns]
     for information_criterion in _information_criterion:
-        if information_criterion in comp_df.columns:
+        if information_criterion in column_index:
             break
     else:
         raise ValueError(


Test patch:
Repository: arviz-devs/arviz

Issue:
Concat fails with empty InferenceData
**Describe the bug**
`arviz.concat` produces incorrect outputs when one of the arguments is an `InferenceData` with no groups.

**To Reproduce**
```python
>>> import arviz as az

>>> idata = az.load_arviz_data("centered_eight")

>>> idata
Inference data with groups:
    > posterior
    > sample_stats
    > posterior_predictive
    > prior
    > observed_data

>>> az.concat(idata, az.InferenceData())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/arviz/data/inference_data.py", line 307, in concat
    group_data = getattr(arg, group)
UnboundLocalError: local variable 'group' referenced before assignment

>>> az.concat(az.InferenceData(), idata)
Inference data with groups:
    > observed_data
```

**Expected behavior**
Both `concat` commands should have produced an `InferenceData` with the same groups and data as `idata`.

**Additional context**
Using master branch on OS X.



Discussion:
I suspect the issue is that these 2 lines need to be indented

https://github.com/arviz-devs/arviz/blob/41279495780f2a3a6f0a8908253753078565c490/arviz/data/inference_data.py#L307-L308
I've replicated the problem on my MacOSX computer, and it appears @sethaxen 's solution will fix. Will submit a PR.

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
@@ -304,8 +304,8 @@ def concat(*args, dim=None, copy=True, inplace=False, reset_dim=True):
                     )
                     msg += " Valid dimensions are `chain` and `draw`."
                     raise TypeError(msg)
-            group_data = getattr(arg, group)
-            args_groups[group] = deepcopy(group_data) if copy else group_data
+                group_data = getattr(arg, group)
+                args_groups[group] = deepcopy(group_data) if copy else group_data
         # add arg0 to args_groups if inplace is False
         if not inplace:
             for group in arg0_groups:


Test patch:
diff --git a/arviz/tests/test_data.py b/arviz/tests/test_data.py
--- a/arviz/tests/test_data.py
+++ b/arviz/tests/test_data.py
@@ -303,6 +303,22 @@ def test_concat_bad():
         concat(idata3, idata, dim="chain")
 
 
+def test_inference_concat_keeps_all_fields():
+    """From failures observed in issue #907"""
+    idata1 = from_dict(posterior={"A": [1, 2, 3, 4]}, sample_stats={"B": [2, 3, 4, 5]})
+    idata2 = from_dict(prior={"C": [1, 2, 3, 4]}, observed_data={"D": [2, 3, 4, 5]})
+
+    idata_c1 = concat(idata1, idata2)
+    idata_c2 = concat(idata2, idata1)
+
+    test_dict = {"posterior": ["A"], "sample_stats": ["B"], "prior": ["C"], "observed_data": ["D"]}
+
+    fails_c1 = check_multiple_attrs(test_dict, idata_c1)
+    assert not fails_c1
+    fails_c2 = check_multiple_attrs(test_dict, idata_c2)
+    assert not fails_c2
+
+
 @pytest.mark.parametrize("inplace", [True, False])
 def test_sel_method(inplace):
     data = np.random.normal(size=(4, 500, 8))
Repository: arviz-devs/arviz

Issue:
Remove parallel from `arviz.utils.full`?
**Describe the bug**
There is nothing to be parallelized.

**To Reproduce**

```
import arviz as az
import os
os.environ["NUMBA_PARALLEL_DIAGNOSTICS"] = "4"

az.utils.full((1000,1000,4), 0)

```

On Windows
```
================================================================================
 Parallel Accelerator Optimizing:  Function full, 
c:\users\ahartikainen\github\arviz\arviz\utils.py (319)  
================================================================================


Parallel loop listing for  Function full, c:\users\ahartikainen\github\arviz\arviz\utils.py (319) 
-----------------------------------|loop #ID
@conditional_jit(parallel=True)    | 
def full(shape, x):                | 
    """Jitting numpy full."""      | 
    return np.full(shape, x)       | 
--------------------------------- Fusing loops ---------------------------------
Attempting fusion of parallel loops (combines loops with similar properties)...
----------------------------- Before Optimisation ------------------------------
--------------------------------------------------------------------------------
------------------------------ After Optimisation ------------------------------
Parallel structure is already optimal.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
 
---------------------------Loop invariant code motion---------------------------

Instruction hoisting:
No instruction hoisting found
--------------------------------------------------------------------------------
```

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Versions of `arviz` and other libraries used, operating system used, and anything else that may be useful.



Discussion:
@Ban-zee what is your opinion?
Yes, we can do that
Can I work on this issue if no one else is?

Resolving patch:
diff --git a/arviz/utils.py b/arviz/utils.py
--- a/arviz/utils.py
+++ b/arviz/utils.py
@@ -319,7 +319,7 @@ def expand_dims(x):
     return x.reshape(shape[:0] + (1,) + shape[0:])
 
 
-@conditional_jit(parallel=True)
+@conditional_jit
 def full(shape, x, dtype=None):
     """Jitting numpy full."""
     return np.full(shape, x, dtype=dtype)


Test patch:
Repository: arviz-devs/arviz

Issue:
Clarify usage of `plot_joint`
## Short Description

The description of how to use `plot_joint` is not very clear about the use and meaning of parameters.

This is partly a usage question and partly a request for documentation improvement.

## Code Example or link

Looking at the docs for `arviz.plot_joint`, I see this: 
```
var_names : Iter of 2 e.g. (var_1, var_2)
    Variables to be plotted, two variables are required.
```
But then when I look at the example, I see this:
```
az.plot_joint(data,
>>>                 var_names=['theta'],
....
```
So … what is an “iter of 2”? `['theta']` is not obviously one, and the example gives a tuple of length 2.
I think what happens in this example is that you are plotting the *single* variable `theta` across a *coordinate* of dimension 2, but this is really quite confusing, and could use a much better explanation.

arviz 0.4.1 (will update!)




Discussion:
@OriolAbril I'd like to complete this task. I'd worked with jointplot before and am familiar with its params. Do I need to only update docstring or also add extra examples? I personally think examples are good enough, we just need to provide an explanation.
Only docstring needs to be updated
Okay I'll update it as soon as I can.

Resolving patch:
diff --git a/arviz/plots/jointplot.py b/arviz/plots/jointplot.py
--- a/arviz/plots/jointplot.py
+++ b/arviz/plots/jointplot.py
@@ -29,8 +29,9 @@ def plot_joint(
     data : obj
         Any object that can be converted to an az.InferenceData object
         Refer to documentation of az.convert_to_dataset for details
-    var_names : Iter of 2 e.g. (var_1, var_2)
-        Variables to be plotted, two variables are required.
+    var_names : str or iterable of str
+        Variables to be plotted. iter of two variables or one variable (with subset having
+        exactly 2 dimensions) are required.
     coords : mapping, optional
         Coordinates of var_names to be plotted. Passed to `Dataset.sel`
     figsize : tuple


Test patch:
Repository: arviz-devs/arviz

Issue:
Rename flat_inference_data_to_dict
Rename `flat_inference_data_to_dict` to `flatten_inference_data_to_dict`.

Any opinions?


Discussion:
I would like to work on it, if it's fine :)

Resolving patch:
diff --git a/arviz/plots/backends/__init__.py b/arviz/plots/backends/__init__.py
--- a/arviz/plots/backends/__init__.py
+++ b/arviz/plots/backends/__init__.py
@@ -63,12 +63,12 @@ def to_cds(
     -------
     bokeh.models.ColumnDataSource object
     """
-    from ...utils import flat_inference_data_to_dict
+    from ...utils import flatten_inference_data_to_dict
 
     if var_name_format is None:
         var_name_format = "cds"
 
-    cds_dict = flat_inference_data_to_dict(
+    cds_dict = flatten_inference_data_to_dict(
         data=data,
         var_names=var_names,
         groups=groups,
diff --git a/arviz/utils.py b/arviz/utils.py
--- a/arviz/utils.py
+++ b/arviz/utils.py
@@ -325,7 +325,7 @@ def full(shape, x, dtype=None):
     return np.full(shape, x, dtype=dtype)
 
 
-def flat_inference_data_to_dict(
+def flatten_inference_data_to_dict(
     data,
     var_names=None,
     groups=None,


Test patch:
diff --git a/arviz/tests/test_utils.py b/arviz/tests/test_utils.py
--- a/arviz/tests/test_utils.py
+++ b/arviz/tests/test_utils.py
@@ -16,7 +16,7 @@
     one_de,
     two_de,
     expand_dims,
-    flat_inference_data_to_dict,
+    flatten_inference_data_to_dict,
 )
 from ..data import load_arviz_data, from_dict
 from ..stats.stats_utils import stats_variance_2d as svar
@@ -275,11 +275,11 @@ def test_expand_dims(data):
     "var_name_format", [None, "brackets", "underscore", "cds", ((",", "[", "]"), ("_", ""))]
 )
 @pytest.mark.parametrize("index_origin", [None, 0, 1])
-def test_flat_inference_data_to_dict(
+def test_flatten_inference_data_to_dict(
     inference_data, var_names, groups, dimensions, group_info, var_name_format, index_origin
 ):
     """Test flattening (stacking) inference data (subgroups) for dictionary."""
-    res_dict = flat_inference_data_to_dict(
+    res_dict = flatten_inference_data_to_dict(
         data=inference_data,
         var_names=var_names,
         groups=groups,
Repository: arviz-devs/arviz

Issue:
Add group argument to plot_joint
## Tell us about it

Add group argument (like the one present in plot density or plot posterior) to plot_joint

Add group argument to plot_joint
## Tell us about it

Add group argument (like the one present in plot density or plot posterior) to plot_joint



Discussion:
I'd like to work on this issue!

I'd like to work on this issue!


Resolving patch:
diff --git a/arviz/plots/jointplot.py b/arviz/plots/jointplot.py
--- a/arviz/plots/jointplot.py
+++ b/arviz/plots/jointplot.py
@@ -6,6 +6,7 @@
 
 def plot_joint(
     data,
+    group="posterior",
     var_names=None,
     coords=None,
     figsize=None,
@@ -29,6 +30,8 @@ def plot_joint(
     data : obj
         Any object that can be converted to an az.InferenceData object
         Refer to documentation of az.convert_to_dataset for details
+    group : str, optional
+        Specifies which InferenceData group should be plotted. Defaults to ‘posterior’.
     var_names : str or iterable of str
         Variables to be plotted. iter of two variables or one variable (with subset having
         exactly 2 dimensions) are required.
@@ -131,7 +134,7 @@ def plot_joint(
             ("Plot type {} not recognized." "Plot type must be in {}").format(kind, valid_kinds)
         )
 
-    data = convert_to_dataset(data, group="posterior")
+    data = convert_to_dataset(data, group=group)
 
     if coords is None:
         coords = {}
diff --git a/arviz/plots/ppcplot.py b/arviz/plots/ppcplot.py
--- a/arviz/plots/ppcplot.py
+++ b/arviz/plots/ppcplot.py
@@ -127,7 +127,7 @@ def plot_ppc(
 
         >>> import arviz as az
         >>> data = az.load_arviz_data('radon')
-        >>> az.plot_ppc(data)
+        >>> az.plot_ppc(data,data_pairs={"obs":"obs"})
 
     Plot the overlay with empirical CDFs.
 
diff --git a/examples/matplotlib/mpl_plot_ppc.py b/examples/matplotlib/mpl_plot_ppc.py
--- a/examples/matplotlib/mpl_plot_ppc.py
+++ b/examples/matplotlib/mpl_plot_ppc.py
@@ -9,4 +9,4 @@
 az.style.use("arviz-darkgrid")
 
 data = az.load_arviz_data("non_centered_eight")
-az.plot_ppc(data, alpha=0.03, figsize=(12, 6), textsize=14)
+az.plot_ppc(data, data_pairs={"obs": "obs"}, alpha=0.03, figsize=(12, 6), textsize=14)


Test patch: